微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

结构化变量替换不适用于 web.config (XML)

如何解决结构化变量替换不适用于 web.config (XML)

八达通服务器 2021.1

我正在尝试使用结构化变量替换功能来替换 web.config (XML) 文件的部分内容,但它仅尝试将文件读取为 Json 和 Yaml 而不是 Xml。该变量的名称如下:/configuration/system.webServer/rewrite/rules/rule/action/@url,其中@url 是元素的属性。 我尝试了很多东西,但似乎无法将 web.config 文件视为 XML 文件 - 有没有人有过在 Octopus Deploy 中使用这种类型的替换的经验?

web.config 中的代码如下所示:

  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <rewrite>
      <rules>
        <rule name="ReverseProxyInboundRule1" stopProcessing="true">
          <match url="^api/(.*)" />
          <action type="Rewrite" url="http://localhost:8053/api/{R:1}" appendQueryString="true" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
||15:22:17   Verbose  |       The file at C:\Octopus\Work\20210612032325-158854-2674\staging\Web.config does not match any kNown filename patterns. The file will be tried as multiple formats and will be treated as the first format that can be successfully parsed.|
|---|---|
||15:22:17   Verbose  |       Attempting structured variable replacement on file C:\Octopus\Work\20210612032325-158854-2674\staging\Web.config with format Json|
||15:22:17   Verbose  |       The file at C:\Octopus\Work\20210612032325-158854-2674\staging\Web.config Couldn't be parsed as Json: Unexpected character encountered while parsing value: <. Path '',line 0,position 0.|
||15:22:17   Verbose  |       Attempting structured variable replacement on file C:\Octopus\Work\20210612032325-158854-2674\staging\Web.config with format Yaml|
||15:22:17   Info     |       No structures have been found that match variable names,so no structured variable replacements have been applied.|
||15:22:17   Info     |       Structured variable replacement succeeded on file C:\Octopus\Work\20210612032325-158854-2674\staging\Web.config with format Yaml|
||15:22:17   Verbose  |       The file at C:\Octopus\Work\20210612032325-158854-2674\staging\Views\Web.config does not match any kNown filename patterns. The file will be tried as multiple formats and will be treated as the first format that can be successfully parsed.|
||15:22:17   Verbose  |       Attempting structured variable replacement on file C:\Octopus\Work\20210612032325-158854-2674\staging\Views\Web.config with format Json|
||15:22:17   Verbose  |       The file at C:\Octopus\Work\20210612032325-158854-2674\staging\Views\Web.config Couldn't be parsed as Json: Unexpected character encountered while parsing value: <. Path '',position 0.|
||15:22:17   Verbose  |       Attempting structured variable replacement on file C:\Octopus\Work\20210612032325-158854-2674\staging\Views\Web.config with format Yaml|
||15:22:17   Info     |       No structures have been found that match variable names,so no structured variable replacements have been applied.|
||15:22:17   Info     |       Structured variable replacement succeeded on file C:\Octopus\Work\20210612032325-158854-2674\staging\Views\Web.config with format Yaml|

解决方法

这应该基于 docs 工作。

这可能是一个错误。现在最好的做法是通过电子邮件向 support@octopus.com 发送详细信息和完整的诊断日志文件。

对于 .NET 配置文件,您可以使用另一种模式来获得 docs 中详述的相同结果,该模式涉及在文件中组合配置文件转换和替换变量模板。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?