asp.net - 部署在 Visual Studio 中工作正常,但使用 MSDeploy 失败

标签 asp.net visual-studio deployment teamcity msdeploy

我有一个 Web 项目,我希望它使用 MSDeploy 将其部署到暂存环境。

从 Visual Studio 发布,使用这些设置一切正常: 服务器:mystaging.com

  • 站点名称:project-staging(我删除了默认网站,这是我的暂存 IIS 中目前唯一的站点)
  • 用户名:管理员
  • 密码:SomePasswordHere
  • 目的地:mystaging.com

(mystaging.com 是一个公共(public)网站 - 显然不是这个)

部署在 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 中工作正常,但使用 MSDeploy 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28091377/

相关文章:

asp.net - IsPostBack 总是返回 false

visual-studio - 使用 MSBuild 构建 InstallShield LE 项目 - 错误 MSB4062

.net - 在构建事件中使用编译器常量

javascript - 如何从 moment 对象获取 "Standard"时区字符串?

asp.net - SignalR 长轮询重新连接行为

deployment - 部署环境和代码分支有什么区别?

java - 让tomcat自动部署带上下文

.net - 我可以使用 ASP.NET 获得 "WAR file"类型的部署吗?

javascript - 在 ajax 查询中加载图像 (ASP.NET)

c# - 如何解决错误 : Could not copy . .. 超过重试次数 10。失败。 - 对比 2017