【问题标题】:Creating a release web.config file创建发布 web.config 文件
【发布时间】:2013-10-09 21:55:08
【问题描述】:

我对这种转换很陌生,我不完全了解如何实现它。这些指南都没有意义。

我要添加

 <identity impersonate="true" userName="asecret" password="mysecurepassword"/>

到发布配置。

我将它放在&lt;system.web&gt; 之后的 web.release.config 中,但它不会这样生成。

你还想做什么。

【问题讨论】:

    标签: asp.net-mvc asp.net-mvc-4 web-config web-config-transform


    【解决方案1】:

    您可能错过了使用 xdt:Transform 属性执行的实际操作。

    试试:

    <identity impersonate="true" userName="asecret" password="mysecurepassword" xdt:Transform="Insert"/>
    

    Insert 应将新元素添加到 web.config 的 &lt;system.web&gt; 部分下。

    如果&lt;identity /&gt; 元素已经存在于主web.config 文件中,您可能需要使用xdt:Transform="Replace",它将主web.config 中的整个元素替换为Web.Release.config 中的元素。或者您可以使用xdt:Transform="SetAttribute({comma listed attributes to set here})",它将设置您指定的属性的值。

    与往常一样,您可以阅读MSDN 上的所有转换选项。

    【讨论】:

    • 谢谢 :) Insert 工作。我之前用xdt:Transform="SetAttributes" 尝试过。现在说得通了。确实是一个愚蠢的问题,但为我节省了很多时间。谢谢。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-07-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-06
    相关资源
    最近更新 更多