One of the most daunting tasks a webmaster must perform is uploading a large web site to a remote web server. Depending on your Internet connection speed, the task can be tedious as files are uploaded to your root directory one file at a time. If you have 10 or 20 files this is not a big deal. But what if you have hundreds or thousands of files to upload? The files can range from code behind files, to images, audio files, DLL files and more.
Luckily Microsoft has introduced a solution to this problem with MS Web Deploy. Web deploy can be used with IIS 7, Web Matrix, Visual Studio, or through the command prompt MS DOS. The first thing that you will need to do is download MSDeploy. This is the tool that will help you package or zip your web site.
Run through the installation wizard to install the “Web Deployment” tool on your computer. You do not need IIS 7 for this. Although Web Deploy and IIS 7 can work side by side, the Web Deployment Tool can run independently. You can install and run this on Windows 7, Vista, or XP without setting up your own local web server.
One thing you do need to install is the “Remote Manager Service.” This should be part of the Web Deployment Tool installation Wizard, but by default the installation does not install it, therefore you will have to manually install it.
The installation will install the MSDeploy command. This command can be invoked using the MS DOS command prompt. One thing you need to be aware of is that MSDeploy requires administrator rights to run properly. The easiest way this can be done is to navigate to MS DOS using Windows Explorer. Go to C:\Windows\System32 and right click on CMD.EXE. Choose “Run as Administrator”.
Once the command prompt is up, you will navigate to the folder level where MSDeploy.exe exists. On Windows 7, the default installation will place msdeploy.exe in C:\Program Files (x86)\IIS\Microsoft Web Deploy.
msdeploy.exe has an extensive command base. Typing [MSDeploy /?] in the command prompt will yield a large selection of commands and conditions you can run. There are two core tasks that MSDeploy can be used for. One is Archiving and the other Packaging. The two are different and each have their own unique properties.
To get started deploying your site with a zip file, one thing you need to know is that you cannot simply use your OS compression tool to zip a website. You will need to use MSDeploy for that. When MSDeploy zips a file, it will also create a couple of xml files. These files are archive.xml and systemInfo.xml. These files describe the properties of your web application. You will need these files to deploy to an IIS server with MSDeploy.
Technically you can manually create these files and then manually zip. However, creating these files from scratch is much more complicated than running MSDeploy. To properly zip your web site, you will first need to navigate to the folder where msdeploy.exe exists. The path to MSDeploy should be C:\Program Files (x86)\IIS\Microsoft Web Deploy V3. Once you are there, run this command in your MSDOS command prompt:
msdeploy.exe -verb:sync -source:iisApp=”C:\ Test_site\Website” -dest:package=c:\Test_site\testsite.zip
You will need to use the provider iisApp so that MSDeploy will know the destination folder will be an application folder. If you are uploading to the root it shouldn’t be a problem since most IIS root folders are already set as an application folder. But if you are going to upload it to a subfolder, zipping the files with the iisApp provider will be important.
Bear in mind that the paths I am using are examples, and it will be up to you to determine the path where your website exists and the path where you want to place the zip file. Once this is done, you can run the MSDeploy command against your remote IIS server:
msdeploy.exe -verb:sync -source:package=”c:\Test_site\testsite.zip” -dest:iisApp=”domain.com/subfolder01″,
wmsvc=domain.com,username=IIS_username,password=IIS_password,
skipAppCreation=false -allowUntrusted=true
The “skipAppCreation” command forces a subfolder to be created as an application folder. By omitting this command the default value will be “true.” If you are uploading directly to your root, you do not need to define this value. You will need to use the iisApp provider as your destination. Otherwise, MSDeploy will not know how to connect to the remote IIS server.
Lastly, the target server where you will be placing your packaged file and uncompressing it will need to have Remote Manager Services installed. Without you will not be able to publish your site with MSDeploy. In addition to that, the MSDeploy (Web Deploy) tool is only for Microsoft platforms. From what I’ve read it will work on an Windows XP, Windows Vista, Windows 7, and even Windows Servers such as Windows 2008. It is not compatible with non-Microsoft platforms such as Linux or Mac.