MSDeploy不会使用MSBuild和Visual Studio 2010部署到远程服务器 [英] MSDeploy doesn't deploy to remote server using MSBuild and Visual Studio 2010
问题描述
我当前正在运行Visual Studio Team System 2010 RC,并且试图获取Build Service安装程序来构建我的解决方案并在其中部署3个Web应用程序.我已经创建了一个名为Integration的自定义生成配置,并在每个Web应用程序的属性"的打包/发布"选项卡上设置了要在目标服务器上使用的IIS网站/应用程序名称".
I'm currently running Visual Studio Team System 2010 RC and I'm trying to get the Build Service setup to build my solution and deploy 3 web applications in it. I've created a custom build configuration called Integration and I've setup the "IIS Web site/application name to use on the destination server" on the Package/Publish tab of the Properties for each of the web applications.
在我的构建定义中,我设置了以下参数:
In my Build Definition I've set the following arguments:
/p:DeployOnBuild = True/p:DeployTarget = MSDeployPublish/p:MSDeployPublishMethod = InProc/p:MsDeployServiceUrl =
/p:DeployOnBuild=True /p:DeployTarget=MSDeployPublish /p:MSDeployPublishMethod=InProc /p:MsDeployServiceUrl=http://my-server-name:8172/msdeploy.axd /p:EnablePackageProcessLoggingAndAssert=True
但是,当我运行构建时,对于所有三个Web应用程序,都会出现以下错误:
However, when I run the build I get the following error, for all three web applications:
更新setAcl(MyProjectName).
Updating setAcl (MyProjectName).
C:\ Program Files \ MSBuild \ Microsoft \ VisualStudio \ v10.0 \ Web \ Microsoft.Web.Publishing.targets(3481,5):错误:Web部署任务失败. (尝试执行未经授权的操作.)
C:\Program Files\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(3481,5): error : Web deployment task failed. (Attempted to perform an unauthorized operation.)
我不认为这是我的实际问题.在日志中的以下条目之后,会发生此错误:更新setAcl 这是导致此错误消息的原因,但似乎MSDeploy试图将其部署到Build服务器上,而不是我使用MsDeployServiceUrl参数指定的服务器上的本地IIS.
I don't think this is my actual problem though. This error is occuring after the following entry in the log: Updating setAcl This is what's causing the error message, but it appears that MSDeploy is trying to deploy to the local IIS on the Build server, not the server I specified with the MsDeployServiceUrl parameter.
在查看位于C:\ Program Files \ MSBuild \ Microsoft \ VisualStudio \ v10.0 \ Web \ Microsoft.Web.Publishing.targets的目标文件后,我添加了EnablePackageProcessLoggingAndAssert,它添加了额外的日志记录.日志显示MsDeployServiceUrl值的空字符串.我在目标中还注意到MsDeployServiceUrl具有小写字母s,这有点令人困惑,因为任务名称MSDeployPublish具有大写字母S.我尝试使用大写字母,然后再次使用小写字母,但是都没有用.
After looking at the targets file at C:\Program Files\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets, I added the EnablePackageProcessLoggingAndAssert, which adds extra logging. The log shows an emptry string for the value of MsDeployServiceUrl. I also noticed in the target that MsDeployServiceUrl has a lowercase s, which is somewhat confusing because the task name MSDeployPublish has an uppercase S. I tried using it using uppercase, then again using lowercase, but neither worked.
还有两点需要注意:
- 我的构建服务以 网络服务.
- 我是服务器 试图部署到另一个 域.
- 我也尝试添加 /p:用户名= mydomain \ myusername /p:password = mypassword到MSBuild参数列表,但这没有帮助.
- My build service is running as NETWORK SERVICE.
- The server I'm trying to deploy to is on another domain.
- I also tried adding /p:username=mydomain\myusername /p:password=mypassword to the MSBuild paramter list, but that didn't help.
有人知道我提供的参数正确吗?还是为我提供正确的答案?
Does anyone know if I'm supplying the correct parameters? Or provide me with the correct ones?
谢谢
推荐答案
在多次修改参数之后,我能够找到解决方案并使构建成功部署.我最终使用的参数是:
After many rounds of changing the parameters, I was able to find a solution and get the build to deploy successfully. The parameters that I ended up using were:
/p:DeployOnBuild=True
/p:DeployTarget=MSDeployPublish
/p:MSDeployPublishMethod=**RemoteAgent**
/p:MsDeployServiceUrl=http://my-server-name
/p:username=myusername
/p:password=mypassword
看来,当对MSDeployPublishMethod
使用InProc
时, MSBuild 会忽略 MsDeployServiceUrl 并始终尝试部署到本地服务器.我将其更改为RemoteAgent
并成功部署.我确实注意到, MyWebApplication_Package 文件夹中不再包含Package文件,但这对我来说并不重要.
It appears that when using InProc
for the MSDeployPublishMethod
MSBuild ignores MsDeployServiceUrl and always tries to deploy to the local server. I changed it to RemoteAgent
and it deployed successfully. I did notice that the Package file is nolonger contained in the MyWebApplication_Package folder, but that isn't a big deal to me.
这篇关于MSDeploy不会使用MSBuild和Visual Studio 2010部署到远程服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!