I have always felt that publishing a site so it works on your remote server is a little bit of a black art. Many stars have to align:
- Files and databases have to transfer
- Settings such as connection strings have to transform to remote values
- Remote server has to be configured properly e.g. must have all dependencies installed
WebMatrix makes no. 1 and 2 significantly easier – it includes support for Web Deploy, FTP and FTPS protocols to transfer content. Second, if you are using Web Deploy, settings are automatically transformed so they work on the remote server. Still, things can go wrong … here are the most common publishing errors and solutions for them:
Error: “The application pool that you are trying to use has the 'managedRuntimeVersion' property set to 'v2.0'. This application requires 'v4.0'.”
Solution: An application pool provides isolation for websites. Typically, web hosting providers create one application pool per website, and set default values for a number of attributes. One of these attributes is the version of the .NET framework. The user can often change this value between .NET 2.0 and .NET 4.0 through the web hosting provider’s control panel. You will see this error during publishing if you are publishing an ASP.NET Web Pages application, which requires .NET 4.0, to a hoster who has given you a website with a .NET 2.0 application pool. Similarly, you will see this error if you are publishing an application that requires .NET 2.0 to a website associated with an .NET 4.0 application pool. The solution is to set the .NET framework version in the web hosting provider’s control panel or, if there are no compatibility issues, change your application’s .NET framework version in WebMatrix’s Settings workspace.
Error: “Username or password incorrect” error when using Web Deploy
Solution: This is probably because the value in Site Name is incorrect. Site Name must contain the name of the IIS site on the remote server. Typically, it matches your domain name, but it doesn’t have to. For example, it can be “Default Web Site” (if you have a dedicated server) or “foo” or “foo.com”. Web Deploy must authenticate to the site before it can execute any providers.
Error: Web management service not started on destination
Solution: You may see this error if you are deploying to a server you have set up yourself. Web Deploy requires a service called Web Management Service (wmsvc) to be running on the remote server. You can get this error if the service is not started. This blog post is a good starting point to learn how to configure a remote server with Web Deploy and wmsvc.
Error: Failed to invoke provider “iisApp”
Solution: Under the covers, WebMatrix users Web Deploy’s iisApp provider to sync files and directories, and to mark folders as applications. You may see this error if delegation rules are not configured correctly on the remote server. Delegation rules allow the user to execute some actions that require administrative privileges, such as marking a folder as an application. This blog post and this one gives good information on how to configure delegation rules.
Error: Bad gateway: check proxy settings
Solution: This one is literally what it says – check proxy settings because Web Deploy traffic is being blocked. Try installing your corporation’s required firewall client, and disabling all settings in Internet Explorer > Tools > Options > Connections > LAN settings.