如何解决结构化变量替换不适用于 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 中使用这种类型的替换的经验?
<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 举报,一经查实,本站将立刻删除。