Testing Web Deploy publishing from Visual Studio 2010 and WebMatrix
by Ben Byrd
So far, we have configured Web Deploy on a server so non-administrators can deploy content to a single site (Default Web Site) as well as databases. In this walkthrough, we will test that we can publish from Visual Studio 2010 and WebMatrix to this server.
Start Visual Studio 2010 and load up the Contoso University C# solution
Click the ContsoUniversity Web Application Project (WAP)
Fill in the dialog as below:
- Service URL. This is perhaps the most important component of this whole screen. Since we are deploying as Administrator, we can simply deploy using the Remote Agent Service. Entering a URL of the form http://{serverName} causes Visual Studio 2010 to deploy using the Remote Agent Service. Not the HTTP prefix.
- Site/application. This is the name of the IIS site and application we are deploying to. For now, we will just deploy to Default Web Site.
- Enter Administrator in User name and the password for the Administrator user on the server.
Click Publish. The Output window will show the deployment as it proceeds. Notice that Visual Studio 2010 is indeed deploying your application over the Remote Agent Service:
If your application does not render in a browser, you may be running into one of two common problems:
- Check that the remote application pool is set to the correct .NET version (4.0 in this case)
- Check if you have all of the application's dependencies installed on the remote. In this case, we need ASP.NET MVC and SQL Server Compact on the remote. Since they can be bin-deployed by Visual Studio 2010, we right-click the WAP and click "Add Deployable Dependencies". Check the two dependencies and re-publish:
Start Visual Studio 2010 and load up the Contoso University solution
Click the ContsoUniversity Web Application Project (WAP)
Fill out the dialog like below:
Note that the Service URL field is slightly different for non-administrator deployments. Filling in just the server name in this field is equivalent to filling in https://{serverName}:8172/MsDeploy.axd, which instructs Web Deploy to deploy using the Web Management Service, which supports non-administrator deployments.
Click Publish. The Output Windows shows that Web Deploy is indeed deploying over the Web Management Service:
If the application does not render correctly in the browser, follow the troubleshooting steps given above in "Testing Administrator Deployment from Visual Studio 2010"
Notice that a small XML containing Web Deploy settings was generated at the end of "PowerShell Scripts for Automating Web Deploy Setup" with the extension of .PublishSettings. the XML contains the following values:
<?xml version="1.0" encoding="utf-8"?>
<publishData>
<publishProfile publishUrl="RWS-2008R2"
msdeploySite="NewSite"
destinationAppUrl="http://RWS-2008R2:81"
mySQLDBConnectionString=""
SQLServerDBConnectionString=""
profileName="Default Settings"
publishMethod="MSDeploy"
userName="NewSiteUser"
userPWD="Passw0rd"
savePWD="True" />
</publishData>
Visual Studio 2010 SP1 does not consume this settings file, but WebMatrix can use it to publish to the server using Web Deploy.
- Copy the settings file to a computer where WebMatrix is installed
- Start WebMatrix
- Click Site from Template and click Bakery to create a very simple ASP.NET site.
- Click Publish
- Click Import publish settings and import the settings file
- Click Save to publish the application.
If publishing to this server succeeds, we know that Web Deploy is set up correctly. If you are seeing issues, read Troubleshooting Common Web Deploy Problems.