4

I have a web project and I would like it to deploy it using MSDeploy to a staging environment.

From Visual Studio publish everything works ok with these settings: Server: mystaging.com

  • Site name: project-staging (I removed the Default Web Site and this is the only site now in my staging IIS)
  • Username: Administrator
  • Password: SomePasswordHere
  • Destination: mystaging.com

(mystaging.com is a public site - obviously not this one)

The deployment works perfectly from Visual Studio.

Trying the same thing from MSDeploy like:

-verb:sync 
-allowUntrusted
-source:contentPath="C:\Users\...\obj\Staging\Package\PackageTmp" 
-dest:contentpath='C:\inetpub\wwwroot\project-staging'
    includeAcls='False',
    ,ComputerName=https://mystaging.com:8172/msdeploy.axd?site=project-staging
    ,UserName=Administrator
    ,Password=SomePasswordHere
    ,AuthType=Basic

fails with:

Error Code: ERROR_USER_UNAUTHORIZED
More Information: Connected to the remote computer ("mystaging.com") using the Web Management Service, but could not authorize. Make sure that you are using the correct user name and password, that the site you are connecting to exists, and that the credentials represent a user who has permissions to access the site.  Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_USER_UNAUTHORIZED.
Error: The remote server returned an error: (401) Unauthorized.
Error count: 1.
Process exited with code -1

I've tried everything (elevating permissions, making other users, etc.) and nothing worked.

Can someone give me a tip on how to fix this issue and having the deploy working from MSDeploy as well?

Robert
  • 10,403
  • 14
  • 67
  • 117
Tamas Ionut
  • 4,240
  • 5
  • 36
  • 59

2 Answers2

1

Do you have access to the target deployment server to analyze aplication, security and webserver logs? Drilling into these, searching for the date and time of the last failed deployment attempt may give more indication of what is going wrong.

Edit: Corrected typo

GlenBee
  • 306
  • 2
  • 11
0

Instead of using contentPath settings, try packaging in a ZIP file using msbuild, and use msdeploy to deploy the package.

"C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe"
           MyWebApp/MyWebApp/MyWebApp.csproj
           /T:Package
           /P:Configuration=Debug;PackageLocation="C:\Build\MyWebApp.Debug.zip";DeployIisAppPath=project-staging

Then deploy:

"C:\Program Files\IIS\Microsoft Web Deploy V2\msdeploy.exe" -verb:sync
     -source:package="C:\Build\MyWebApp.Debug.zip"
     -dest:auto,wmsvc=devserver,username=deployuser,password=*******
     -allowUntrusted=true

That may give you different results in your environment. In this case, the remote web server is running the Web Deploy Service. The ZIP deployment package can also be installed manually. It works for me (see the blog post i based this on).

Raul Nohea Goodness
  • 2,549
  • 23
  • 24