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.

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.

“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.

“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…

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!