RSS

Caveat of using msdeploy to sync web or ftp sites in IIS7

19 Mar

MSdeploy.exe is an important tool that you can use to sync web sites or ftp sites. I was testing msdeploy to keep two IIS7 FTP sites in sync. I used the following command:

msdeploy -verb:sync -source:apphostconfig="ftproot" -dest:apphostconfig="ftproot",computername=2ndserver

The sync works of course, but at the same time I found that one of my folders in d:\data was also syncing to the 2nd server. It had delete all other folders and files in the d:\data on the 2nd server!

The reason it seems is that the sync verb will sync everything including physical folders defined by your FTP virtual directory! The problem was that I had created an FTP virtual directory whose physical path is d:\data. This caused msdeploy to also sync any FTP vdir physical path to the 2nd server and with undesirable effects if you don’t want this to happen. If you only want to sync the FTP vdir but not the sync the contents of the physical folders, you need to get msdeploy to skip folders with the following:

msdeploy -verb:sync -source:apphostconfig="ftproot" -dest:apphostconfig="ftproot",computername=2ndserver -skip:objectName=dirpath,absolutePath=".*"
Advertisements
 
Leave a comment

Posted by on March 19, 2015 in Windows

 

Tags:

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: