- Processes, standards and quality
- Technologies
- Others
MSDeploy is a command-line executable tool created by Microsoft, which implements web deploy functionality with many powerful features. In this article I will present a simple way to publish your web application to IIS by using this tool.
To use MsDeploy you need to download and install Microsoft Web Deploy (here is a link to the installer). After installation MSDeploy command line tool (msdeploy.exe) will be located in C:Program Files (x86)IISMicrosoft Web Deploy V3. When you type in console msdeploy.exe /? you will see version of MSDeploy, list of providers (objects for which you can perform operations, such as web sites, databases or folders), list of verbs (operations which can be performed on providers, for example delete or update web site). Also, you will see some interesting and useful switches for deploy parameters such as rules and link extensions, which I will not describe here. You can read about them in Microsoft documentation.
Remote deploy ASP.NET application to IIS.
We need three things to deploy ASP.NET application to IIS on remote machine:
– install Web Deploy 3.5 (MSDeploy) on the server on which you will be deploying ASP.NET application,
– create a local user which will be used by MSDeploy to publishing application,
– package with ASP.NET application, in our case it will be a folder with application created by Visual Studio (publish option), it can also be a zip file.
Once these conditions are fulfilled, you can run the MSDeploy command from any machine (with msdeploy.exe) against your remote IIS server:
D:>"C:\Program Files (x86)\IIS\Microsoft Web Deploy V3\msdeploy.exe" -verb:sync -source:iisApp="D:WebApplication" -dest:iisApp="Default Web Site/WebApp",ComputerName="https://server:8172/MsDeploy.axd",UserName='ServerUser',Password='password',AuthType='Basic' -allowUntrusted
- -verb:sync – execute operation which synchronizes data between source and destination,
- -source:iisApp=”D:WebApplication” – directory with application to deploy. With the provider iisApp the MSDeploy will know the destination folder will be an application folder,
- -dest:iisApp=”Default Web Site/WebApp”, – target application in IIS,
- ComputerName=”https://server:8172/MsDeploy.axd”,UserName=’ServerUser’,Password=’password’ – the target server with IIS, where application will be placed, also user login and password, which will be used to perform deploy,
- AuthType=’Basic – the type of authentication; there are two available: NTLM and Basic.
Here, you can find a log result from our deploy example. We can see which folder was added, deleted or updated:
MSDeploy can deploy not only web applications, but also you can use it to deploy almost anything (for example folders or databases). Here is an exemplary command which will deploy folder on target server:
D:>"C:\Program Files (x86)\IIS\Microsoft Web DeployV3\msdeploy.exe" -verb:sync -source:dirPath="D:WebApplication" -dest:ComputerName="https://server:8172/MsDeploy.axd",UserName='ServerUser',Password='password',AuthType='Basic,dirPath="D:DestinationPath"' -allowUntrusted
MSDeploy also supports the -whatif flag, showing you what will happen without doing anything.
With MsDeploy we are able to deploy any application very easily. The MSDeploy (Web Deploy) tool is created only for Microsoft platforms (it works with Windows XP, Windows Vista, Windows 7, Windows 8 and with Windows Servers such as Windows 2008).