WebMatrix: Deploying Orchard Website to a Shared Hosting Site

In a previous post, I discussed how to create and work with a CMS web site using WebMatrix. In this post, we will discuss how to deploy the website to a hosting account.

To download and install WebMatrix, click here.

You can find the detailed instructions on “How to publish a web application using WebMatrix” here. There are more than two thousand files, depending how many themes and modules you have in the solution. Therefore the publication process can take more than half an hour or longer.

image

I ran into a few questions and issues during deployment and would like to share my findings or workarounds with you.

Does My Hosting Provider such as GoDaddy Support WebMatrix Websites?

Hosting companies such as https://www.asphostcentral.com and https://www.discountasp.net are known for supporting WebMatrix (containing files with extension .cshtml). You can find other hosting companies that support WebMatrix.

But what about GoDaddy? Does GoDaddy support WebMatrix? The answer is Yes (for WebMatrix 7.1.10731 and Orchard 1.4). I was able to deploy a sample site to a GoDaddy.com shared hosting account, and didn’t have to create custom MIME type. Make sure that you assign Read and Write rights to the folder. This should be good news if you are using DoDaddy shared hosting plans on Windows.

Why didn’t the Web Deploy Option Work but the FTP Option Worked?

It’s likely that port 8172 is blocked. My colleague Andrew Duthie reported the issue in his post “WebDeploy tip for WebMatrix…watch out for port blocking”. While it is possible to unlock the port or use a different port, using FTP may be your best bet when working with a shared hosting account.

For more info on Wed Deploy and port 817, read ScottGu’s post “Automating Deployment with Microsoft Web Deploy”. Below are some excerpts from his post.

One thing to watch for is whether you have a firewall enabled on your server, or within the cluster where your server is hosted. By default the Management Service runs using the HTTPS protocol on port 8172. This port might be locked down by default depending on your hosting configuration. If so you should either unlock it with your firewall/hoster – or pick a different port number that is allowed. You can test to see whether the management service is available simply by opening up a browser and accessing it using a URL like: https://yourservername:8172/MsDeploy.axd – if you are prompted for a username/password then you know it is working, and there is no firewall blocking access to it. If it times out then it is likely that a firewall is blocking it.

If you are using Windows Server 2008 the default format of the URL is https://mysite:8172/MsDeploy.axd Note the protocol is “https://” and the port should match whatever you specified when you enabled the IIS Management Service above.

If you are publishing against a Windows Server 2003, Windows 7, or Windows Vista machine then the default format of the URL is https://server-name/ (not https – since the security credentials are sent using built-in Windows authentication which is encrypted). You also don’t need to specify a port number with Windows Server 2003, Windows 7 or Windows Vista.

What are the differences between Web Deploy and FTP?

One obvious different is the required input values on the Settings screen. For example, Web Deploy asks for Site Name (e.g. https://siteurl/myapp), but FTP asks for Site Path (e.g. /myapp).

Another difference has to do with database deployment. If you use Web Deploy, you will be able to include database deployment for SQL Server or SQL Express (not for SQL Compact).  If you use FTP, you will be able to copy SQL Company database as File.

Check out the How to Deploy a web application using WebMatrix article for detail.

SQL Server, SQL Express and SQL Compact Databases

You can use either SQL Compact or SQL Express/SQL Server database when you configure you web site.

If you choose SQL Compact database, you have two options after setting up the website.

1. Optionally, migrate Compact Database or a local SQL Server/SQL Express, or remote SQL Server database. For instructions, see Migrate a database to SQL Server.

2. You can copy the compact database file during deployment via FTP and run the site on the server with the compact database. But you should be aware that the compact database has some limit by design and that the web site doesn’t scale well.

If you choose SQL Server or SQL Express, you will be able to deploy the database schema and data using Web Deploy.

The Publish process failed due to some files with “~” prefix

TheJournalist theme contains one file, “~2ehgignore.I”, which caused an error. Replace “~” with “_”. I have yet to find out the impact of the change, but it should fix the error.

image

How to Deploy Files Individually

The easy to use Publish wizard checks files that have been updated since last publication and lists them if any automatically. However, if you delete a theme or module on the server and want to re-publish them, you will have to use a different tool. I have used a free FTP tool called Core FTP LE, which you can download here.

image