So I'm setting up a Jenkins job that will build and deploy an application that I have. Building it is easy, but I'm having issues deploying it.

Here is my build command:

"C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe" "AppName\AppName.csproj" /T:Build;Package /p:Configuration=DEBUG /p:OutputPath="obj\DEBUG" /p:DeployIisAppPath="/sub.domain.com/AppName" /p:VisualStudioVersion=14.0

sub.domain.com is the website name on IIS, and AppName is an application under it.

Now here is mostly my deploy command which doesn't work:

"C:\Program Files (x86)\IIS\Microsoft Web Deploy V3\msdeploy.exe" -verb:sync -source:package="AppName\obj\Debug\_PublishedWebsites\AppName_Package\AppName.zip" -dest:auto,computerName="https://webserver:8172/msdeploy.axd",username=jenkins,password=jenkins,authType=basic -allowUntrusted=true

Now in IIS I have a manager user set up with the above credentials and has permissions over both the site and application. But whenever I run this command I end up getting a ERROR_USER_UNAUTHORIZED message.

What do I need to change in my deploy command to get it so I can deploy to the web server?


1 Answer 1


If your deployment user is not an administrator, than it shall be added as management user to IIS site (let assume that it is named "my_iis_site"), it shall have enough file system permissions for site folder (modify/delete/create at least) and your deployment command shall show to handler that you are going to execute in scope of this site:

"C:\Program Files (x86)\IIS\Microsoft Web Deploy V3\msdeploy.exe" -verb:sync -source:package="AppName\obj\Debug\_PublishedWebsites\AppName_Package\AppName.zip" -dest:auto,computerName="https://webserver:8172/msdeploy.axd?site=my_iis_site",username=jenkins,password=jenkins,authType=basic -allowUntrusted=true

So, the trick is to pass to msdeploy.axd handler site name as a query string 'site=my_iis_site'

  • Right on! So my question now is, since I'm publishing to an application under a site, do I need to specify that all in the msdeploy command? So if my application is my_iis_site/AppName, does that get specified?
    – Chiggins
    Mar 23, 2016 at 19:06
  • Have not used such a scenario before - but, following logic my_iis_site/AppName shall work Mar 23, 2016 at 19:20
    – Chiggins
    Mar 28, 2016 at 19:40
  • Can you check and post error in you event log from MsDeploy provider? Cause it is hard to say what's the problem, basing on MsDeploy error code - they are pretty bad. Also, IMHO, it is worth checking this post: forums.iis.net/post/2042792.aspx Mar 29, 2016 at 18:30
  • Here's what I'm getting from the eventlog pastebin.com/B5pFNPxA
    – Chiggins
    Mar 29, 2016 at 19:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.