Understanding the basics of web deploy

The first encounter you probably will have with web deploy (a.k.a. MSDeploy or the Web Deployment Tool) as a Microsoft developer using asp.net is the “publish” web application option in Visual Studio.


Yes, that’s right…when you push that button it uses web deploy through the MSBuild build system to accomplish a publish of your web application…either to a local “package” file or to a remote IIS.

But seriously, how many developers out there actually publish from their developer machine directly to the target environment?
Strange enough, that’s what most MS demonstrations will show off.

Anyway…what VS is really good at, web deploy vice, is to package your website as a deployable unit (a package in web deploy terms). More on this in future posts perhaps though.

Getting past the VS publish button

Usually, you have a more “complex” deployment process than “push the button” and that’s when it’s good to know how to manually get in control of the web deploy pipeline and steer it in the direction you want.

The Web Deployment Tool (Web Deploy) is a command-line tool that is used for synchronizing Web sites and Web servers

– as Microsoft likes to tell us.

Personally, I started using web deploy about 6 months ago and I had problems understanding how to tweak the deployment process.
This post is meant to make that easier for someone like me 6 months ago…just starting out with web deploy.

Disclaimer: this is not a complete overview…it’s the basics…alright.

There are numerous great resources out on the Internet on this topic, here are some the ones I have found useful:

A simple example: stopping an IIS application

This is the command we will look at:


…which will stop the IIS application for a “local (**)” IIS site named www.test.example.com if you’re interested.

A great starting point is the technet documentation for web deploy…which can be a little…well technical…so let’s dissect the command above and look at the parts that it consists of to get a better understanding for it.

I’ll try to highlight each part as we go through the example command.

Web Deploy: Command Line (msdeploy.exe)

**local  – What do I mean with “local ” then? 

Well, in order to run this command you have to be admin and logged on to the server that hosts the IIS that includes the IIS application www.test.example.com and run the command locally on that server…ok?
Of course web deploy also supports executing remote commands but let’s start with the basics for now.

Web Deploy is a whole area of things related such as:

  • The web deploy API
  • Command-Line executable (uses the API)
  • PowerShell commandlets (uses the API)
  • IIS extensions etc

What you’ll be most probable to get into is the command-line (msdeploy.exe) so this post will focus on that…OK.

The msdeploy.exe command-line executable implements Web Deploy functionality.
One thing worth to notice is that you always use your own msdeploy.exe to execute the commands…even if they execute against a remote server (but as I said…more on this in future posts perhaps)

On my machine it’s located at: C:\Program Files\IIS\Microsoft Web Deploy V2\ (which is version 2…yeah I need to upgrade right?!)

note: if you use the command-line a lot it’s probably a good idea to add this path to the environment paths variables so you don’t have to give the absolute path every time or navigate to the directory.


Web Deploy: Operations

“Web Deploy operations enable you to gather information from, move, or delete deployment objects like Web sites and Web applications.”


The principal element of the msdeploy.exe command-line is the verb, a.k.a the operation. A verb determines the action to be taken on a source or destination object.

In the example, the operation is called sync (dump and delete are two others) and is specified on the command-line through the verb switch argument.

The sync operation synchronizes data between a source and a destination.

…which leads us into operation settings…

Web Deploy: Operation Settings

“Web Deploy operation settings are non-provider specific command-line flags”


The verb and source are required. A destination is required by some verbs, but not others. (the sync verb required dest for example)

source and dest are examples of web deploy operations settings and are specified on the command-line as arguments (-).

They are used in conjunction with the sync operation to let it know the source and destination to synchronize between.

But that’s not enough though…we need more to configure the operation settings…providers are the answer.

Web Deploy: Providers

“Providers process specific source or destination data for Web Deploy.
On the Web Deploy command line, the provider name is specified immediately after the -source: or -dest: argument.”


Here’s an example of two different providers, one is used on the source operation setting and the other on the destination operation setting; recycleApp and auto

recycleApp is a provider that….well, recycles applications.

note: recycleApp uses =”…”. That’s something is known as a provider attribute (sort of like an identity) which you use to control which application to recycle. The provider attribute/s and the options they have will vary from provider to provider though.

auto is a provider that uses the same parameters on destination as on source, handy in some situations.

But we can do even more…configure the actual providers.

Web Deploy: Provider Settings

“Providers can be optionally modified by using provider settings. Provider settings can be added to either a source or a destination by using the general syntax ,ProviderSettingName=ProviderSettingValue”


Some provider settings can be used on any/most providers and are considered general.
Some examples of these may include remote computer name, user name, password etc.

The example above uses recycleMode which is actually a specific recycleApp provider setting that tells it to stop the application pool.

There’s lots lots more to know about web deploy but this is an introduction

My hope is that you might have a better understanding now than before you read this post at least…


, , , ,

  1. #1 by posicionamiento web sevilla on January 16, 2013 - 08:54

    Wow that was strange. I just wrote an incredibly long comment but after I clicked submit my comment didn’t appear. Grrrr… well I’m not writing
    all that over again. Anyways, just wanted to say excellent blog!

  1. Practical Web Deploy Provider Examples « Johan Leino

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: