【问题标题】:web deploy parameters.xml settings not making their way into the web.config fileweb deploy parameters.xml 设置未进入 web.config 文件
【发布时间】:2012-03-19 20:58:51
【问题描述】:

我已经创建了一个 parameters.xml 并验证了 xpath 可以与在线工具 http://www.xpathtester.com/ 一起使用

<?xml version="1.0" encoding="utf-8" ?>
<parameters>
  <parameter name="Website URL" description="Please provide the base web address for the external part of the application" defaultValue="https://someOtherSite.com">
    <paramterEntry kind="XmlFile" scope="\\web.config$" match="/configuration/appSettings/add[@key='ExternalSiteBaseUrl']/@value" />
  </parameter>
  <parameter name="Authentication Service URL" description="Please provide the web address for the authentication service" defaultValue="http://someOtherSite.com/auth">
    <paramterEntry kind="XmlFile" scope="\\web.config$" match="/configuration/appSettings/add[@key='AuthServiceAddress']/@value" />
  </parameter>
</parameters>

当我通过 IIS 导入 zip 文件时,我进入带有连接字符串的设置页面,这两个选项按预期显示。无论我将值设置为什么,它们都会被忽略。 web.config 中的值保持不变。但是会应用连接字符串更改。在随后弹出的摘要中,有几行表明连接字符串在范围内,但与这两个值没有任何关系。有没有我遗漏的步骤?

【问题讨论】:

    标签: asp.net webdeploy


    【解决方案1】:

    所以神奇的答案是这里声明的范围将找到第一个 web.config,它恰好是我的 MVC 站点中的一个区域。因为那里不存在参数,所以它正在跳过并正常进行

    【讨论】:

    • 那么,你还记得你是如何解决这个问题的吗?我现在遇到同样的问题。另外,您是否知道是否有办法从 VS-2015 发布向导中获取自动生成的 SetParameters.xml 文件中包含的此类参数。 (就像现在一样,每次发布时它都会被覆盖,并且我的自定义参数会丢失。)
    • 嗯,我似乎错过了/@value 部分,解释了为什么没有添加该值。现在可以使用与您的示例类似的代码,只是没有 &lt;parameter&gt; 元素的 \` in front of web.config$. Also I added `。
    • 另外,关于我自己关于如何将其纳入发布向导生成的结果的问题,我发现我可以在解决方案中将&lt;parameter&gt; 元素添加到此文件中:/obj/Release/CSAutoParameterize.parameters.xml - 然后它作为&lt;setParameter&gt; 元素自动添加到&lt;project&gt;.SetParameters.xml 文件中。在这种情况下,我建议将CSAutoParameterize.parameters.xml 文件中的默认值留空,并在发布后将该值添加到&lt;project&gt;.SetParameters.xml 文件中。这样更灵活。
    猜你喜欢
    • 2012-06-11
    • 1970-01-01
    • 2023-03-17
    • 1970-01-01
    • 1970-01-01
    • 2015-08-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多