Setting up Web Deploy 3.0 / MSDeploy

I’m currently on the path of converting one of my sites from SFTP deployments to using Web Deploy 3.0 and thought it might be interesting to document the process and the pitfalls that I run into. My approach is roughly based on this guide, but it wasn’t a complete fit for me, so here we go.

Motivation

So why would you want to use Web Deploy for deploying web sites? Compared to regular file copy or FTP deployments, Web Deploy offers the option of running a dedicated deployment service on your server, that is actually aware of IIS and can help you make your deployments as smooth as possible. In my case, my SFTP service had started to lock random assemblies recently, and since I’d been wanting upgrade to Web Deploy anyway, I thought now might be as good a time as any.

Web Deploy can do a bunch of things for you, such as syncing IIS sites (6, 7 and 8), deploying packages, archiving sites by offering a multitude of different providers. This post is dedicated to deploying a rather simple site that is already bin deployable.

My setup

My setup is a remote server running Windows Server 2008 R2 with IIS 7.5 and a development environment on a Windows 7 Ultimate machine.

The site is an ASP.NET 4.0 mixed WebForms / MVC project. The application itself manages database migrations, so they’re not in scope for the post either.

Setup steps

1 - Created a dedicated deployment user for use with deployment. It’s nice to know that everything is locked down, when you open up remote access.

2 - Installed Management Service role for my IIS in Server Manager.

3 - Changed Web Management Service to Start automatically (delayed) and specified a specific deployment user.

4 - Configured Management Service within IIS.

Like this:

5 - Created a new site in IIS. Gave the deployment user access to the site folder on the web server.

6 - Gave the deployment user access to the site through IIS Manager Permissions.

7 - Installed Web Deploy 3.0 including IIS Deployment Handler (wasn’t visible in the first custom install). Not using Platform installer. The IIS Deployment handler install option was not visible the first time I tried, because I hadn’t installed the Management Service in IIS.

8 - The guide told me to add rules, but rules already existed in Management Service Delegation.

(Already existing rules:)

9 - Installed IIS on my local machine. Was rather freshly paved, so I hadn’t yet. I’m guessing most of you can skip this step.

10 - Wasn’t able to ‘Connect to Site’ as mentioned in test guide – so I installed IIS Manager for Remote Administration v1.1 using Web Platform Installer.

11 - Connected to the Site.

12 - Selected the site.

13 - … aaaaand imported my application package that I’d created through Visual Studio.

14 - Profit!

Conclusion

Now this is a rather crude picture guide. But hopefully it’ll still be useful to some people. I know I’ll check it next time I’m setting up Web Deploy.

My next goals are to adapt my rake scripts for the application to create the package on my TeamCity server and add one-click deployments directly from TeamCity.