限制 ASP.NET web.config 中的部分继承
Restrict section inheritance in ASP.NET web.config
我有一个从路径 \X 运行的 asp.net 应用程序,子文件夹中还有另一个应用程序说 \X\Y
都有 web.config 个文件。
如果我在应用程序 Xweb.config 中插入以下部分
<system.diagnostics>
<trace autoflush="true" indentsize="0">
<listeners>
...
应用程序 Y 也会尝试使用它(但会失败,因为在 X 中使用的侦听器是我自己的 class,而在 Y 中不存在)。我不希望它.. 但我想保留其他部分使用 X 的继承(出于遗留原因)。
如何单独关闭 system.diagnostics 部分的继承?
显然您需要将有问题的部分包装在:
<location path="." inheritInChildApplications="false">
...
</location>
我有一个从路径 \X 运行的 asp.net 应用程序,子文件夹中还有另一个应用程序说 \X\Y
都有 web.config 个文件。
如果我在应用程序 Xweb.config 中插入以下部分
<system.diagnostics>
<trace autoflush="true" indentsize="0">
<listeners>
...
应用程序 Y 也会尝试使用它(但会失败,因为在 X 中使用的侦听器是我自己的 class,而在 Y 中不存在)。我不希望它.. 但我想保留其他部分使用 X 的继承(出于遗留原因)。
如何单独关闭 system.diagnostics 部分的继承?
显然您需要将有问题的部分包装在:
<location path="." inheritInChildApplications="false">
...
</location>