簡體   English   中英

是否可以僅通過命令行使用非管理員帳戶發布/部署Web軟件包?

[英]Is it possible to publish/deploy a web package, using a non-admin account, from the command line only?

標題需要擴展。 總而言之,我發現不可能:

  • 將網站部署到IIS 8主機
  • 使用Web部署程序包
  • 在VS 2013中使用現成的發布功能
  • 使用非管理員的IIS管理器用戶,該用戶被委派了部署到給定站點的權限

似乎所有細節都歸結為一個小細節,但是我應該描述我的過程,直到一切都破裂。

我在VS 2013中創建了一個發布配置文件Publish ,配置為發布到Web程序包。 然后,我在開發人員命令提示符處觸發以下命令:

msbuild Solution.sln /t:Build /p:DeployOnBuild=true;PublishProfile=Publish;IsDesktopBuild=false

這經歷了構建過程,現在我在_PublishedWebsites\\Web_Package文件夾中看到了預期的軟件包和部署文件。 我的下一步是從Web_Package文件夾運行此文件:

Web.deploy.cmd /Y /M:https://example.blah:8172/MsDeploy.axd /U:user /P:p@44w0rd /A:Basic

這就是問題所在。這導致以下擴展命令(為便於閱讀而進行了格式化):

msdeploy.exe
    -source:package='.\Web.zip'
    -dest:auto,computerName="https://example.blah:8172/MsDeploy.axd",userName="user",password="p@44w0rd",authtype="Basic",includeAcls="False"
    -verb:sync 
    -disableLink:AppPoolExtension 
    -disableLink:ContentExtension 
    -disableLink:CertificateExtension 
    -setParamFile:".\Web.SetParameters.xml"

其執行結果為:

Error Code: ERROR_USER_UNAUTHORIZED
More Information: Connected to the remote computer ("example.blah") 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.

我可以通過手動僅重新運行擴展命令並在site參數上標記MsDeploy.axd URL來解決此問題,如下所示:

msdeploy.exe
    -source:package='.\Web.zip'
    -dest:auto,computerName="https://example.blah:8172/MsDeploy.axd?site=example.blah",userName="user",password="p@44w0rd",authtype="Basic",includeAcls="False"
    -verb:sync 
    -disableLink:AppPoolExtension 
    -disableLink:ContentExtension 
    -disableLink:CertificateExtension 
    -setParamFile:".\Web.SetParameters.xml"

但是,我看不到通過MSBuild自動生成的Web.deploy.cmd進行此設置的任何方法。 如果我嘗試這樣做:

Web.deploy.cmd /Y /M:https://example.blah:8172/MsDeploy.axd?site=example.blah /U:user /P:p@44w0rd /A:Basic

結果如下(再次格式化以便於閱讀):

msdeploy.exe
    -source:package='D:\DEV\Solution\Web\bin\_PublishedWebsites\Web_Package\Web.zip'
    -dest:auto,computerName="https://example.blah:8172/MsDeploy.axd?site",userName="user",password="p@44w0rd",authtype="Basic",includeAcls="False"
    -verb:sync 
    -disableLink:AppPoolExtension 
    -disableLink:ContentExtension 
    -disableLink:CertificateExtension 
    -setParamFile:"D:\DEV\Solution\Web\bin\_PublishedWebsites\Web_Package\Web.SetParameters.xml"  example.blah
Error: Unrecognized argument 'example.blah'. All arguments must begin with "-".
Error count: 1.

我可以使用管理員帳戶執行此過程。 但似乎非管理員需要此site = querystring值,而自動生成的Web.deploy.cmd卻沒有任何此值。

我在這里錯過明顯的東西嗎? 在IIS管理端是否缺少我的權限? 我已經確保按照博客中的指示設置了“管理服務委托”規則。

我無法使用所設計的方法來解決此問題。 我在這里的解決方案是簡單地使用擴展的MSDeploy.exe命令行並直接使用它,而不是使用生成的*.deploy.cmd文件。

當然,如果有人為我的原始問題提供了實際的解決方案,我會很樂意將標記為答案。 在那之前,這是我的解決方案。

您可以將/ M:參數放在引號中,如下所示:

Web.deploy.cmd /Y "/M:https://example.blah:8172/MsDeploy.axd?site=example.blah" /U:user /P:p@44w0rd /A:Basic

暫無
暫無

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

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