Workaround for FTP Authorization Rules being deleted on sync

NOTE: This is a cross-post from Interested in learning more about Web Deploy? Follow us on Twitter @wdeploy

I had a customer contact me with an issue: FTP Authorization Rules for a site were being deleted after sync.

He has two IIS 7 servers (call them source-server and destination-server), and there’s an FTP website called “MyFtpSite” on both servers. Destination-server has some extra settings for MyFtpSite, specifically FTP Authorization Rules, which are not present on source-server. The customer ran this command on source-server:

msdeploy.exe -verb:sync -source:webServer -dest:auto,computername=destination-server -skip:website="MyFtpSite"

msdeploy.exe command line provides nice syntatic sugar, –skip:website=<websiteName> for skipping a whole website. Once this command ran, he noticed that MyFtpSite’s content was untouched but its FTP Authorization Rules were deleted. What was going on?


Under the covers, –skip:website=<yourWebsite> is the same as doing –skip:objectName=<yourWebsite>. This will skip all objects named yourWebsite. However, I looked at destination-server’s applicationHost.config, and voila, FTP Authorization Rules were being declared in a <location> tag. It turns out there’s a bug in Web Deploy v1.1. where the –skip:website syntactic sugar does not skip <location> tags and, as a result, it’s an object the source does not see, so it’s deleted:

<location path="MyFtpSite"> <system.ftpServer> <security> <authorization> <add accessType="Allow" users="*" permissions="Read, Write" /> </authorization> </security> </system.ftpServer> </location>

What’s the workaround? You have to have a separate skip for the <location> tag:


msdeploy.exe -verb:sycn -source:webServer -dest:auto,computername=destination-server -skip:website="MyFtpSite" -skip:xPath="//section[@name='system.ftpServer/security/authorization']"

Note: I should really make this skip a little tighter, because it will skip syncing system.ftpServer/security/authorization sections for ANY website. But you get the idea … Smile

No Comments