簡體   English   中英

在Visual Studio中部署可以正常運行,使用MSDeploy失敗

[英]Deployment works ok in Visual Studio, fails using MSDeploy

我有一個Web項目,我想使用MSDeploy將其部署到暫存環境。

通過Visual Studio發布,使用以下設置可以正常運行:服務器:mystaging.com

  • 網站名稱: project-staging (我刪除了默認網站,這是我的暫存IIS中唯一的站點)
  • 用戶名:管理員
  • 密碼:SomePasswordHere
  • 目的地:mystaging.com

(mystaging.com是一個公共站點,顯然不是此站點)

該部署可從Visual Studio完美地工作。

從MSDeploy嘗試同樣的事情,例如:

-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

失敗與:

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

我已經嘗試了所有方法(提升權限,建立其他用戶等),但沒有任何效果。

有人可以給我提示如何解決此問題以及使部署也可以從MSDeploy進行嗎?

您是否有權訪問目標部署服務器以分析應用程序,安全性和Web服務器日志? 深入研究這些內容,搜索最后一次失敗的部署嘗試的日期和時間,可能會更多地指示出問題所在。

編輯:改正錯別字

與其使用contentPath設置,不如嘗試使用msbuild將其打包在ZIP文件中,然后使用msdeploy部署該包。

"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

然后部署:

"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

在您的環境中,這可能會給您帶來不同的結果。 在這種情況下,遠程Web服務器正在運行Web部署服務。 ZIP部署程序包也可以手動安裝。 它對我有用( 請參閱基於此的博客文章 )。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM