I'm trying to deploy a Windows application to a specific path on my remote server, using the dirPath provider. I'm able to deploy websites with no issue to this same server, using a syntax like the following:
msdeploy.exe -verb:sync -source=iisApp=C:\SomePath -dest:authType=basic,wmsvc=MyServer,userName=MyUser,password=MyPassword,iis=MySite/MyApp -allowUntrusted
However, I get 401 Unauthorized errors (for unknown reasons) when attempting a similar command using dirPath:
msdeploy.exe -verb:sync -source=dirPath=C:\SomePath -dest:authType=basic,wmsvc=MyServer,userName=MyUser,password=MyPassword,dirPath=C:\SomeRemotePath -allowUntrusted
The only thing I've found to work here is to switch to using the computerName syntax, like this:
msdeploy.exe -verb:sync -source=dirPath=C:\SomePath -dest:authType=basic,computerName=https://MyServer:8172/msdeploy.axd?site=MySite,userName=MyUser,password=MyPassword,dirPath=C:\SomeRemotePath -allowUntrusted
This would be fine, but computerName requires the site be passed as a query string parameter, and "MySite" in this case is actually "Default Web Site". I cannot for the life of me figure out how to escape the spaces here properly, given that I'm actually generating this command line with an MSBuild file (and executing it with an Exec statement). If I specify %20 in the MSBuild file (e.g., Default%20Web%20Site), it resolves it back to a space before executing the command, which results in an invalid syntax. If I try a double escape (escaping %, 2, and 0 separately, e.g., Default%25%32%30Web%25%32%30Site), I go back to 401 Unauthorized errors.
So, is there some syntax or server configuration that would allow me to use "wmsvc=[server]" in this command, given that it does not require the problematic (inescapable?) site query parameter? Or can someone tell me how to escape "?site=Default Web Site" properly within an MSBuild Exec command that is executing the MSDeploy command above?
EDIT: Before someone suggests that I just rename Default Web Site to something without spaces, yes, that works, but I'm trying to find a way to avoid that, as I'd like a generic solution that can work with the default name of the IIS website on any given server.
computerName="https://.../Default Web Site"- The Muffin Man