无法使用转换删除Web.Config节点 [英] Unable to Remove Web.Config Nodes using Transform

查看:127
本文介绍了无法使用转换删除Web.Config节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个web.config,其中包含如下重写规则:

I have a web.config containing rewrite rules like this:

<system.webServer>
    <rewrite>
      <rules><!-- Some rules here --></rules>
    </rewrite>
</system.webServer>

对于特定的部署配置,我想完全删除<rewrite>节点.

For a particular deployment configuration, I want to remove the <rewrite> node entirely.

我尝试这样做:

<system.web>
    <rewrite xdt:Transform="RemoveAll" />
</system.web>    

基于此文档:

http://msdn.microsoft.com/en-us/library/dd465326.aspx

,但<rewrite>节点仍然存在.

我想念什么?

推荐答案

嗯,我刚刚尝试过,这是我的转换文件.

Hmm I just tried this here is my transform file.

<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">

  <system.webServer>
    <rewrite xdt:Transform="RemoveAll" />
  </system.webServer>

</configuration>

结果如下: 仅供参考,由 SlowCheetah .

And here is the result: FYI preview provided by SlowCheetah.

我还打包了该Web项目,并验证了web.config确实没有重写节点.这里要尝试的一件事是删除obj \文件夹,然后重试.你能告诉我结果吗?

I also packaged the web project and verified that the web.config indeed did not have the rewrite node. One thing to try here is to delete your obj\ folder and try again. Can you let me know the results?

这篇关于无法使用转换删除Web.Config节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆