有时从web.config文件中删除了system.webserver中的设置 [英] Settings from system.webserver sometimes removed from web.config file

查看:119
本文介绍了有时从web.config文件中删除了system.webserver中的设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在IIS7.5中遇到了一个令人讨厌的错误,该错误有时会删除web.config中标记的内容。它不仅会在运行时删除内容,而且还会实际更新文件。

We've come across a rather annoying bug in IIS7.5 where it occasionally removes the contents of the tag in the web.config. It doesn't just remove the contents at runtime, it actually physically updates the file.

在我们的本地计算机上,它会在我们重建所有内容时发生(包括替换application.config) (来自源代码控制),并且在我们的服务器计算机上,它会在应用程序池重新启动时发生。两种情况都是断断续续的。

On our local machines it happens when we rebuild everything (which includes replacing application.config from source control) and on our server machines it happens on app pool restart. Both cases are intermittent.

这似乎正在发生,因为我们在配置的根目录中有一些配置,而在位置标记中有一些。这样做的原因是因为我们在根应用程序下面有一些虚拟应用程序,并且我们不希望它们继承处理程序和模块。我们具有根system.webserver标记,因为有一些我们要继承的设置(例如validateIntegratedModeConfiguration)。

It seems to be happening because we have some config at the root of the config and some in a location tag. The reason we do this is because we have some virtual applications underneath the root application and we don't want them to inherit the handlers and modules. We have the root system.webserver tag because there are some settings (like validateIntegratedModeConfiguration) that we want to inherit.

它仅影响system.webserver设置,而不影响位置标记内。如果将所有内容都移到位置标记中,就可以了。

It only affects the system.webserver settings not inside the location tag. If you move everything into the location tag it is fine.

我们的web.config看起来像这样:

Our web.config looks something like this:

<system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    ...
</system.webServer>
<location path="." inheritInChildApplications="false">
    <system.webServer>
      <modules>
        ...
      </modules>
      <handlers accessPolicy="Read, Script">
        ...
      </handlers>
    </system.webServer>
 </location>

还有其他人遇到这个问题吗?

Anyone else come across this problem?

推荐答案

我们最终将配置移出了根system.webserver,并移到了位置标记中。然后,我们还将其添加到所有子应用程序中。

We ended up moving the configuration out of the root system.webserver and into the one inside the location tag. Then we also added it to all the child applications.

<location path="." inheritInChildApplications="false">
    <system.webServer>
      <validation validateIntegratedModeConfiguration="false" />
      <modules>
        ...
      </modules>
      <handlers accessPolicy="Read, Script">
        ...
      </handlers>
    </system.webServer>
 </location>

尽管这不是理想的解决方法,但它已解决了删除配置的问题。

Though it's not an ideal workaround, it has solved the problem with the configuration being removed.

这篇关于有时从web.config文件中删除了system.webserver中的设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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