使用MSDEPLOY部署Web软件包

使用MSDEPLOY部署Web软件包

问题描述:

我已经构建了程序包,并阅读了此文档@ http://www.asp.net/web-forms/overview/deployment/web-deployment-in-the-enterprise/deploying-web-packages

I've built my packages and read through this docs @ http://www.asp.net/web-forms/overview/deployment/web-deployment-in-the-enterprise/deploying-web-packages

而且似乎说明问题应该从此处开始相对简单,因为说明清楚地表明了这一点...

And it seems to suggest that the problem should be relatively simple from here as the instructions clearly show ...

[project name].deploy.cmd [/T | /Y]
                          [/M:<computer name>]
                          [/A:<Basic | NTLM>]
                          [/U:<user name>]
                          [/P:<password>]
                          [/L]
                          [/G:<true | false>]
                          [Additional MSDeploy.exe flags]

..所以,没问题,我想我会给这样的命令参数...

.. so, no problem I thought I will give the command params like this ...

myproj.deploy.cmd /Y /M:test.foo.com /A:basic /U:<my user> /P:<my pass>

...,其中用户和通行证是我服务器上的管理员帐户.

... where the user and pass are an admin account on my server.

尽管出于某种原因,这会导致401 ...

For some reason though this results in a 401 ...

Error code: EEROR_USER_NOT_ADMIN
More Information: Connected to 'server' using the Web Deployment Agent Service but could not authorize. Make sure you are an administrator on 'server'

...好吧,我使用了我的管理员凭据,就像一键部署时使用了VS一样,它们在VS中工作,所以为什么在推送软件包时它们在命令行上不起作用?

... well, I used my admin credentials, the same ones I used with VS for the one click deploy and they worked in VS so how come they aren't working on the command line when pushing the package?

...

我查看了日志,检查了生成的ms deploy命令,并决定完全跳过cmd文件,直接自己进行ms deploy.

I looked through the logs, checked out the ms deploy command it was generating and decided to skip the cmd file altogether and go straight to ms deploy myself.

我找到了它正在生成的命令,并将其清理为类似这样的内容...

I found the command it was generating and cleaned it up to something like this ...

msdeploy.exe
  -source:package='..\package.zip' 
  -dest:auto,computerName=test.foo.com,userName=<me>,password=<my pass>,authtype=basic,includeAcls=False 
  -verb:sync 
  -disableLink:AppPoolExtension 
  -disableLink:ContentExtension 
  -disableLink:CertificateExtension 

很明显,在这种情况下使用我的帐户不是管理员(完全撒谎,或者我错过了一些东西).

Apparently my account when used in this context is not an admin (a total lie or perhaps I missed something).

这是Technet不得不说的: https://technet.microsoft.com/zh-CN/library/dd569106(v=ws.10).aspx

here's what technet has to say on it: https://technet.microsoft.com/en-gb/library/dd569106(v=ws.10).aspx

: https://technet.microsoft.com/zh-CN/library/dd569001(v=ws.10).aspx

说明...

Web部署工具不执行本地模拟.如果你 提供用户名和密码提供程序设置的值,但可以 没有为computerName指定远程计算机的名称 设置,您提供的凭据将无效.

The Web Deployment Tool does not perform local impersonation. If you provide values for the username and password provider settings but do not specify the name of a remote computer for the computerName setting, the credentials that you provide will have no effect.

这是否是因为我指定的是域名,而不是计算机名,所以我指定的凭据已被忽略?

does this mean because I am specifying a domain name and not a machine name the credentials I am specifying have been ignored?

如果是的话...我应该怎么做?

If so ... how am I supposed to do this?

无论如何仍未记录在案……答案是...

Apprently undocumented anyway ... the answer is ...

您不能在同一台计算机上运行与MSDeploy服务对话的MS deploy命令.

You can't run MS deploy commands that talk to the MSDeploy service on the same machine.

不知道为什么,这没有任何意义,但是即使将相同的命令部署到我遇到问题的同一个盒子上,执行相同的命令并在另一个盒子上执行似乎也可以正常工作.

No idea why, this makes no sense, but taking the same command and executing it on another box seems to work fine even when deploying to the same box I had the issue on.

Microsoft做得好...使团队服务管理员的梦想成真!

Well done Microsoft ... way to make a Team Services Admins life a dream!