【问题标题】:Configuring Parameters for Web Package Deployment to modify config element为 Web 包部署配置参数以修改配置元素
【发布时间】:2016-11-14 10:07:30
【问题描述】:

我有这个 web.config,我希望使用 msdeploy 工具在构建时更改一个 xml 元素。

  <customBinding>
    <binding name="customBinaryBinding">
      <binaryMessageEncoding>
        <readerQuotas maxStringContentLength="20971520"/>
      </binaryMessageEncoding>
      <httpTransport maxReceivedMessageSize="2147483647" authenticationScheme="Negotiate" maxBufferSize="2147483647"/>
    </binding>
  </customBinding>

如何配置我的 Parameters.xml 和 SetParameters 以使其从 httpTransport 更改为 httpsTransport。我是新手,请多多包涵:)。

【问题讨论】:

    标签: xml parameters build config msdeploy


    【解决方案1】:

    您可以将 XML 节点替换为 parameterEntry 匹配值,该匹配值将您希望替换为 XPath 引用的节点作为目标。例如,

    <parameters>
      <parameter name="MyTestParam" description="My Test Param" defaultValue="&lt;httpsTransport  /&gt;">
        <parameterEntry kind="XmlFile" scope="web\.config" match="//binding[@name='customBinaryBinding']/httpTransport" />
      </parameter>
    </parameters>
    

    以下博文有更多详细信息-

    https://blogs.iis.net/elliotth/web-deploy-xml-file-parameterization

    还有一个快速更正,WebDeploy 参数化发生在部署时而不是构建时。这是首选,因此您可以构建一次,创建一个包并将其多次部署到不同的环境。下面的文章描述了参数化,并介绍了一个有用的 VS 扩展来预览参数化结果。

    http://www.dotnetcatch.com/2014/09/08/parameterizationpreview-visual-studio-extension/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-06-13
      • 1970-01-01
      • 1970-01-01
      • 2012-09-13
      • 2014-07-19
      • 1970-01-01
      • 1970-01-01
      • 2017-10-14
      相关资源
      最近更新 更多