Publishing to Web Deploy on a Windows 7 computer running IIS

Web Deploy is typically set up on a Windows Server computer; however, if you are developing on a local machine, you may want to publish to your local IIS server before you even push out to a remote IIS server. In this blog post, I will walk you through how to do this.

Assumption: Your computer has Visual Studio 2010 installed and there is a Web Application Project (WAP) ready to publish.

I will cover two cases in this blog post: publishing to localhost (so source and destination are the same), and publishing to a different Windows 7 computer from the one you have Visual Studio 2010 installed on (so source and destination are different).

1. Install IIS 7 and IIS Manager on the destination computer

You can also use the Windows Programs Control Panel to install IIS – which takes a while! Thankfully there is a single link you can click to install these components using the Web Platform Installer (WebPI). If you are not familiar with WebPI, it’s a small executable which automates the installation of web platform components.

2. Install Web Deploy on the destination computer

Skip this step if you are publishing to localhost and go to step 3(a).

Otherwise, you need to install Web Deploy 2.0. You obtain it here for x86 and x64. In the installer, choose Custom. Make sure that the highlighted components are installed. We only need two components: the core Web Deploy framework, and the Remote Agent Service.

*The second piece is important: *only the Remote Agent Service is available when you are deploying to a Windows 7 computer, so we must make sure it is installed. This also means that you will need to deploy to the IIS server with Administrator credentials, because that’s the only mode the Remote Agent Service supports.

image

The installer with also start the Remote Management Service.

3(a). Publishing to localhost

  • Start Visual Studio 2010 as Administrator and open your WAP.

  • Right-click the WAP and click “Publish…”. This will bring up the Publish Settings dialog where you can enter Web Deploy settings. Fill them out like below:

    • Service URL: http://www.bilalaslam.com. The http prefix is important because it tells VS to publish to the Remote Agent Service.

image

3(b). Publishing to a different Windows 7 computer

  • Start Visual Studio 2010 and open your WAP.

  • Right-click the WAP and click “Publish…”. This will bring up the Publish Settings dialog where you can enter Web Deploy settings. Fill them out like below:

    • Service URL: http://servername. The http prefix is important because it tells VS to publish to the Remote Agent Service

    • Username: This is important. Make sure you provide the built-in Administrator or domain administrator credentials on the remote Windows 7 server. Because of a bug in Web Deploy, no other administrator credentials on the remote server will work.

    • Click Publish. The Output window will show the build output and you will see files being synced to the site.

image

  • You can also publish a deployment package from the command-line. Assuming you have created a deployment package, run it like follows:

ProjectName.deploy.cmd /y /M:remotecomputer /u:Administrator /p:adminpassword –allowUntrusted /A:basic

This tells the batch file to run a Web Deploy sync over the Remote Agent Service, ignore certificate errors and using basic (instead of NTLM) authentication.