破坏MsBuild包&部署到单独的 MsBuild 和 MsDeploy 命令中

发布于 2024-10-29 07:36:00 字数 1645 浏览 7 评论 0原文

我在将 MsBuild package+deploy 命令分解为两个单独的命令时遇到一些问题。 (我需要这样做才能将其他参数传递给 MsDeploy)。

工作正常的命令如下所示:

msbuild "src\Solution.sln" 
  /P:Configuration=Deploy-Staging 
  /P:DeployOnBuild=True
  /P:DeployTarget=MSDeployPublish
  /P:MsDeployServiceUrl=https://192.168.0.1:8172/MsDeploy.axd
  /P:DeployIISAppPath=staging.website.com 
  /P:AllowUntrustedCertificate=True 
  /P:MSDeployPublishMethod=WmSvc 
  /P:CreatePackageOnPublish=True 
  /P:UserName=staging-deploy 
  /P:Password=xyz

分离的打包命令如下所示:

msbuild "src\Solution.sln" 
  /P:Configuration=Deploy-Staging 
  /P:DeployOnBuild=True
  /P:DeployTarget=Package 
  /P:_PackageTempDir=C:\temp\web

工作正常。但随后 MsDeploy 部分:

msdeploy 
 -verb:sync 
 -allowUntrusted 
 -usechecksum
 -source:manifest=
  'src\WebProject\obj\Deploy-Staging\Package\WebProject.SourceManifest.xml'  
 -dest:auto,ComputerName=
  'https://192.168.0.1:8172/MsDeploy.axd?site=staging.website.com',
   username='staging-deploy',password='xyz',authType='basic',includeAcls='false'
 -enableRule:DoNotDeleteRule

失败,WmSvc.log 中出现以下错误

wmsvc.exe Error: 0 : Attempted to perform an unauthorized operation.
setAcl/C:\temp\web (Read)
ProcessId=15784
ThreadId=31
DateTime=2011-03-30T14:57:02.4867689Z
Timestamp=3802908721815
wmsvc.exe Error: 0 : Not authorized.
Details: No rule was found that could authorize user 'staging-deploy', 
         provider 'setAcl', operation 'Read', path 'C:\temp\web'.

(以及其他几个读/写操作)

它尝试访问的路径显然出了问题(因为它与其他方法一起工作正常) - 我'我不确定它是否尝试正确使用 iisApp 目标,目前我认为也不会部署正确的 web.config。

I'm having a few problems breaking out an MsBuild package+deploy command into two separate commands. (I need to do this to pass additional parameters to MsDeploy).

The command that works fine looks like this:

msbuild "src\Solution.sln" 
  /P:Configuration=Deploy-Staging 
  /P:DeployOnBuild=True
  /P:DeployTarget=MSDeployPublish
  /P:MsDeployServiceUrl=https://192.168.0.1:8172/MsDeploy.axd
  /P:DeployIISAppPath=staging.website.com 
  /P:AllowUntrustedCertificate=True 
  /P:MSDeployPublishMethod=WmSvc 
  /P:CreatePackageOnPublish=True 
  /P:UserName=staging-deploy 
  /P:Password=xyz

The separated packaging command looks like this:

msbuild "src\Solution.sln" 
  /P:Configuration=Deploy-Staging 
  /P:DeployOnBuild=True
  /P:DeployTarget=Package 
  /P:_PackageTempDir=C:\temp\web

which works fine. But then the MsDeploy portion:

msdeploy 
 -verb:sync 
 -allowUntrusted 
 -usechecksum
 -source:manifest=
  'src\WebProject\obj\Deploy-Staging\Package\WebProject.SourceManifest.xml'  
 -dest:auto,ComputerName=
  'https://192.168.0.1:8172/MsDeploy.axd?site=staging.website.com',
   username='staging-deploy',password='xyz',authType='basic',includeAcls='false'
 -enableRule:DoNotDeleteRule

fails, with the following error in WmSvc.log

wmsvc.exe Error: 0 : Attempted to perform an unauthorized operation.
setAcl/C:\temp\web (Read)
ProcessId=15784
ThreadId=31
DateTime=2011-03-30T14:57:02.4867689Z
Timestamp=3802908721815
wmsvc.exe Error: 0 : Not authorized.
Details: No rule was found that could authorize user 'staging-deploy', 
         provider 'setAcl', operation 'Read', path 'C:\temp\web'.

(and several more Read/Write operations)

Something is clearly going wrong with the paths it's trying to access (as it works fine with the other method) - I'm not sure it's even trying to use the iisApp targeting correctly, and at the moment I don't think the correct web.config's will be deployed either.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

倾城泪 2024-11-05 07:36:00

我现在已经解决了这个问题 - 我需要一个与自动生成的 .cmd 文件使用的命令不同的命令,但是比较这两个命令可以让我修复它(感谢@Vishal R. Joshi)

我需要的差异是:

  • 基本身份验证
  • 允许不受信任的证书
  • ?site=staging.webserver 位于 MsBuild.axd 路径末尾,与我的原始命令一样
  • 覆盖 params 文件中设置的 IIS Web 应用程序名称
  • 启用不删除规则

获胜命令如下:

msdeploy 
 -verb:sync 
 -allowUntrusted 
 -source:package='src\WebProject\obj\Deploy-Staging\Package\WebProject.zip'  
 -dest:auto,ComputerName=
  'https://192.168.0.1:8172/MsDeploy.axd?site=staging.website.com',
  username='staging-deploy',password='xyz',authType='basic',includeAcls='false'
  setParamFile:
    "src\WebProject\obj\Deploy-Staging\Package\WebProject.SetParameters.xml"
 -setParam:name='IIS Web Application Name',value='staging.website.com'
 -enableRule:DoNotDeleteRule
 -disableLink:AppPoolExtension -disableLink:ContentExtension 
 -disableLink:CertificateExtension

希望这对某人有帮助!

I've got this fixed now - I needed a different command to the one the automatically generated .cmd file was using, but comparing the two allowed me to fix it up (thanks @Vishal R. Joshi)

The differences I needed was:

  • basic authentication
  • allow untrusted certificates
  • ?site=staging.webserver on the end of the MsBuild.axd path, as with my original command
  • override the IIS Web App name that is set in the params file
  • enable the do not delete rule

The winning command is as follows:

msdeploy 
 -verb:sync 
 -allowUntrusted 
 -source:package='src\WebProject\obj\Deploy-Staging\Package\WebProject.zip'  
 -dest:auto,ComputerName=
  'https://192.168.0.1:8172/MsDeploy.axd?site=staging.website.com',
  username='staging-deploy',password='xyz',authType='basic',includeAcls='false'
  setParamFile:
    "src\WebProject\obj\Deploy-Staging\Package\WebProject.SetParameters.xml"
 -setParam:name='IIS Web Application Name',value='staging.website.com'
 -enableRule:DoNotDeleteRule
 -disableLink:AppPoolExtension -disableLink:ContentExtension 
 -disableLink:CertificateExtension

Hope this helps someone!

赴月观长安 2024-11-05 07:36:00

使用 inetmgr 在服务器上添加委派规则,以允许 staging-deploy 执行 set-Acl 操作。
Inetmgr->点击服务器节点->管理服务委托(管理中)->点击右侧添加规则->选择标有“设置应用程序权限”的模板 ->接受默认值并单击“确定”。

这应该允许您使用 setAcl 部署任何包或清单,只要您部署的用户拥有您要部署到的站点的权限。

Add a delegation rule on the server using inetmgr to allow staging-deploy to carry out set-Acl operations.
Inetmgr -> Click on server node -> Management Service Delegation (in Management) -> Click Add rule to the right -> Choose the template labelled "Set Permissions for Applications" -> Accept defaults and click OK.

This should let you deploy any package or manifest with setAcl as long as the user you are deploying as, has permissions to the site you are deploying to.

梦里梦着梦中梦 2024-11-05 07:36:00

您可以在调用从 Web 项目生成包时创建的 MyProject.deploy.cmd 文件时指定 -setParam:name='',value='' 标志。 cmd 是 msdeploy.exe 的友好包装器,因此您无需指定所有其余的默认值。

详细信息如下: http://evolutionarydeveloper.blogspot.co .uk/2013/05/specifying-environment-variables-at.html

You are able to specify the -setParam:name='',value='' flag when calling the MyProject.deploy.cmd file that is created when you generate a Package from a web project. The cmd is a friendly wrapper around msdeploy.exe, so you have no need to specify all the rest of the defaults.

Here's the details: http://evolutionarydeveloper.blogspot.co.uk/2013/05/specifying-environment-variables-at.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文