Prerequisites
This post is based on a developer machine running Visual Studio 2010.
The target machine, ie the web server we want to publish our website to, is running Windows Server 2008 with IIS 7.5.
Install Web Deploy on the server
Install the Web Deploy tool on the target server. Note that I wasn’t able to do it through Web Platform Installer since that wouldn’t add the Management Service Delegation icon to IIS Manager. Instead I downloaded the MSI and ensured the IIS 7 Deployment Handler (including its sub-features) were installed:
Configure the Management Service
After installing Web Deploy, if you select the server node in IIS Manager on the target server…
…you should see a Management Service and a Management Service Delegation icon:
Double-click the Management Service Delegation icon and ensure the Allow administrators to bypass rules option is selected:
Next, double-click the Management Service icon to set up remote access:
Next, click Start to ensure the Management Service is running:
You should see two separate services, Web Deployment Agent Service and Web Management Service, running on the target machine:
Set up a local administrator account on the target machine
In my case the target machine wasn’t on the same domain as the developer machine, so I set up a local account with administrator privileges on the target machine:
Publish from Visual Studio 2010
To publish our website to the target server we right-click the project node in Solution Explorer in Visual Studio and click Publish:
Enter the target machine’s URL in the Service URL textbox (note that the HTTPS protocol is used, you’ll get a 404 error if you try to use HTTP).
Enter the target website’s name in the Site/application textbox (this is the friendly name of the site, ie the name that is displayed in the IIS Manager node tree).
Unless you have a signed certificate on the target machine you need to check the Allow untrusted certificate checkbox.
Finally, enter the username and password of the local administrator account.
Finally, click Publish to publish your project to the target machine.
You can see the actions performed by, and result of, the publish by looking in the Output pane in Visual Studio:
Missing the Management Service icons
If you’re missing the Management Service or Management Service Delegation icons in IIS Manager you might be missing the Management Service feature.
Go to Server Manager, expand the Roles node and then right-click Web Server (IIS):
Next, make sure the Management Service option under Management Tools is selected:
Note that this has to be done before installing Web Deploy, otherwise some features will be missing when running the Web Deploy installer.