通过 [proj].deploy.cmd 发布时,Web Deploy 返回 401 未经授权
我在 Web 部署方面遇到了一些问题,我似乎无法解决。每次我尝试通过包中的 [proj].deploy.cmd 命令发布到 WMSvc 时,我都会收到“远程服务器返回错误:(401) 未经授权”。该命令如下所示(项目名为“Web”,服务器名为“AutoDeploy”):
Web.deploy.cmd /Y /M:https://AutoDeploy:8172/MsDeploy.axd -allowUntrusted
我可以将罚款发布到 https://AutoDeploy: 8172/MsDeploy.axd 通过 Visual Studio,因此该服务肯定正在运行,并且我可以成功以管理员身份对其进行身份验证。以管理员身份登录(这只是一个本地 Win 2k8 VPC)时在计算机上本地运行此程序不起作用,并且使用管理员帐户添加 /U 和 /P 参数不会执行任何操作。
我已启用失败请求跟踪并且收到此输出所以至少有一些东西可以参考,但不幸的是我无法确定根本原因是什么。我正在尝试使用与 Visual Studio 中相同的凭据连接到相同的服务,但显然有些不同。
只是出于兴趣,我可以将罚款发布到 Web 部署代理服务 (MsDepSvc),如下所示:
Web.deploy.cmd /Y /M:http://AutoDeploy/MsDeployAgentService /U:AutoDeploy\Administrator /P:...
但我真的想让 WMSvc 运行!有什么想法吗?
I'm having a bit of a problem with Web Deploy I just can't seem to iron out. Every time I try and publish to WMSvc via the [proj].deploy.cmd command in the package I'm getting "The remote server returned an error: (401) Unauthorized". The command looks like this (project is called "Web", server is named "AutoDeploy"):
Web.deploy.cmd /Y /M:https://AutoDeploy:8172/MsDeploy.axd -allowUntrusted
I can publish fine to https://AutoDeploy:8172/MsDeploy.axd via Visual Studio so the service is definitely running and I can successfully authenticate to it as administrator. Running this locally on the machine against the package while logged on as administrator (it's just a little local Win 2k8 VPC) isn't working and adding /U and /P parameters with the administrator account does nothing.
I've enabled failed request tracing and am getting this output so at least there's something to refer to but unfortunately I can't determine what the root cause is. I'm trying to connect to the same service with the same credentials as in Visual Studio but obviously something is different.
Just out of interest, I can publish fine to the Web Deployment Agent Service (MsDepSvc) as follows:
Web.deploy.cmd /Y /M:http://AutoDeploy/MsDeployAgentService /U:AutoDeploy\Administrator /P:...
But I really want to get WMSvc running! Any thoughts?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
萨义德的上述评论为我指明了正确的方向。将构建输出详细程度设为“详细”并在 .csproj 中将 UseMsdeployExe 设置为 true 后(另一个 来自 Sayed 博客的提示),我发现 Visual Studio 生成的命令将身份验证类型设置为基本,回想起来,考虑到纯文本用户名和密码,这一点是显而易见的。
关于如何:使用部署安装部署包的 MSDN 帖子.cmd 文件 解释说您只需在命令中添加一个“a”标志即可进行设置。简而言之,它现在看起来是这样的(并且实际上是有效的):
Sayed's comment above got me pointed in the right direction. After making the build output verbosity "Detailed" and also setting UseMsdeployExe to true in the .csproj (another tip from Sayed's blog), I found the command generated by Visual Studio was setting the authentication type to basic which retrospectively, is obvious given the plain text username and password.
The MSDN post on How to: Install a Deployment Package Using the deploy.cmd File explains you can just add an "a" flag to the command to set this. So in short, here's how it now looks (and actually works):