Don’t Install Web Deployment Tool using the Web Platform Installer

After a bit of time wondering why I couldn’t just hit Publish on my web application within Visual Studio 2010 and have it deployed using the new Web Deployment Tool I tracked it down to some missing bits. I’d just gone through the process of building a new development server and as part of setting up the services I need I used the Web Platform Installer. What I wanted to do was configure the server so that when I create a new web project on my development machine using VS2010 I could then use Publish from within VS to deploy it to my development server. Having read through a couple of blog posts on how to do this I figured it can’t be that difficult since most of them say “install the Web Deployment Tool using the Web Platform Installer” and then Publish away. Well it isn’t that easy basically because the platform installer only installs half the bits.

Installing WebDeploy and Management Service

Ok, so lets start with the bits you do need to make sure you install. These are the Web Deployment Tool (of course) and the Management Service (not so obvious but kinda required if you want to remotely publish your applications to IIS).

image image

Now the next thing to do is to go and actually install the Web Deployment Tool from the MSI. You can do this by downloading it from http://www.iis.net/download/WebDeploy. This should prompt you to change, repair or remove – select Change and install the missing components. This will give you the bits in IIS Manager to actually manage permissions and delegation so that you can remotely deploy your application.

So far you’ve been doing the default install for the Web Deployment Tool which uses port 80…. but wait, isn’t that what your website is running on? If it is, then you need to customise your install, for example:

msiexec /i <msi_filename> /passive ADDLOCAL=ALL LISTENURL=http://+:8080/MSDEPLOY2/

Alternatively, if you’re like me and only building a dev server then you could always just change your web site (within IIS) to run off a different port. In my case I created a new Web Site using port 8080, which meant I just went with the defaults for webdeploy.

Remote Access

Select the Web Server node in IIS Manager followed by double-clicking the Management Service icon. Stop the Management Service from the Actions list – this will enable the Enable Remote Connections checkbox. Check the Enable Remote Connections checkbox. You can configure other options such as the port and the SSL certificate to use. You need to make sure there is an exception in the server firewall for the port used by the Management Service. By default the Management Service uses a self signed certificate – this isn’t an issue if your doing internal deployments and the clients don’t care about ensuring the integrity of the server they are communicating with. If you are exposing it out of your network you should change the certificate. Start the Management Service from the Actions pane.

image

Configure Deployment Account

The next step is to set up the Management Service for remote deployment of your web application. In my case I set up a Windows user, WebsiteDeploy, that belongs to the Administrators group. This is the user that will create the application within IIS on the server when you publish your web application.

Within IIS Manager select the Web Site you want to enable remote deployment for. Double-click the icon entitled IIS Manager Permissions in the Feature View when the Web Site is selected. From the Actions list select Allow User and enter or select the name of the user that you want to enable (in my case WebsiteDeploy).

image

Delegation

Now that you have enabled the user you need to delegate remote access to that user. You do that by selecting the web server node and double-clicking the Management Service Delegation (this icon doesn’t appear if you only use the Web Platform Installer to install the Web Deployment Tool). Select Add Rule from the Actions list and then select Deploy Applications with Content. If you only want to deploy content then you can select the Deploy Content Only option.

image

I went with the default values and that seems to work for the new rule.

image

You may need to restart the Management Service which you can do by reselecting the Web Server node in IIS Manager, select the Management Service feature and then click Restart from the Actions pane.

You should now be ready to deploy from within Visual Studio 2010. To test this capability I created a new web application, WebApplication1, based on the ASP.NET Web Application. Without making any changes to the application I right-clicked the Web Application project node in Solution Explorer and selected Publish.

image

You’ll notice that all I needed to enter for the Service URL was the ip (or machine name) of the server you are deploying too. Of course this does rely on the Management Service port (default is 8172) being open on the firewall of your server. Also, don’t for get to Allow untrusted certificates unless you configured the Management Service to use a trusted certificate.

Hope this helps you get your server set up for One-Click Publishing. Let me know if there are pieces missing that I may have overlooked.

Leave a comment