【问题标题】:web.config transformationweb.config 转换
【发布时间】:2012-01-09 09:47:45
【问题描述】:

我正在尝试使 Web 配置转换正常工作,但没有成功。

我的网络应用中有一个文件夹,其中包含以下内容:

<?xml version="1.0"?>
<configuration>
  <system.web>
    <authorization>
      <allow roles="ADMINISTRATORS"/>
      <allow roles="OPERATOR"/>
      <deny users="?"/>
    </authorization>
  </system.web>
</configuration>

我创建了转换文件,并在 Release 转换版本中移动了部分。不幸的是,这不起作用。 如果配置设置为调试,我不想在我的网络配置中包含该部分,否则我需要。

关于如何使它工作的任何建议?

【问题讨论】:

标签: c# asp.net web-config transformation web-config-transform


【解决方案1】:

感谢您提供的链接,我之前已经看过它们,但请不要停下来阅读所有内容。

解决方法很简单(设置在:

<?xml version="1.0" encoding="utf-8" ?>
<!-- For more information on using transformations 
     see the web.config examples at http://go.microsoft.com/fwlink/?LinkId=214134. -->
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">

  <system.web>
    <authorization>
      <allow roles="ADMINISTRATORS" xdt:Transform="Insert"/>
      <allow roles="OPERATOR" xdt:Transform="Insert"/>
      <deny users="?" xdt:Transform="Insert"/>
    </authorization>
  </system.web>

</configuration>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-08-12
    • 2012-03-24
    • 1970-01-01
    • 2017-11-29
    • 2010-12-31
    • 2015-09-21
    相关资源
    最近更新 更多