【问题标题】:Deployment works ok in Visual Studio, fails using MSDeploy在 Visual Studio 中部署工作正常,使用 MSDeploy 失败
【发布时间】:2015-01-22 14:38:11
【问题描述】:

我有一个 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 工作吗?

【问题讨论】:

    标签: asp.net visual-studio deployment teamcity msdeploy


    【解决方案1】:

    您是否有权访问目标部署服务器来分析应用程序、安全性和网络服务器日志?深入研究这些,搜索上次失败的部署尝试的日期和时间可能会更清楚地表明出了什么问题。

    编辑:更正错字

    【讨论】:

      【解决方案2】:

      尝试使用 msbuild 打包到 ZIP 文件中,而不是使用 contentPath 设置,然后使用 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 部署包也可以手动安装。它对我有用 (see the blog post i based this on)。

      【讨论】:

        猜你喜欢
        • 2010-10-27
        • 2015-10-04
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-11-09
        相关资源
        最近更新 更多