简体   繁体   English

iis应用程序和子应用程序,web.config的交互

[英]iis apps & subapps, interaction of web.config

We've got a web server which has been running a number of separate applications within the same site with no problem. 我们有一个Web服务器,该服务器已经在同一站点中运行了许多单独的应用程序,没有任何问题。 I just added a new application at the root. 我只是在根目录添加了一个新应用程序。 Many of these applications use routing tables in global.asax, as does the one I added to root. 这些应用程序中的许多应用程序都使用global.asax中的路由表,就像我添加到root的路由表一样。 And I got an error that turned out to be that in web.config, in the <modules> and <handlers> sections, my new root app added a handler with the same name as one in a "sub" app. 我发现在web.config的<modules>和<handlers>部分中出现一个错误,我的新root应用程序添加了一个与“ sub”应用程序中同名的处理程序。 But all these apps are using the same name for modules and handlers: it's too support routing tables, and they're all called "UrlRoutingModule" and "UrlRoutingHandler". 但是所有这些应用程序对于模块和处理程序都使用相同的名称:它也支持路由表,它们都被称为“ UrlRoutingModule”和“ UrlRoutingHandler”。

That is, say we have existing apps foo and bar run as http://example.com/foo and http://example.com/bar . 也就是说,假设我们现有的应用程序foo和bar以http://example.com/foohttp://example.com/bar运行。 Both foo and bar add a handler called "UrlRoutingHandler". foo和bar都添加了一个名为“ UrlRoutingHandler”的处理程序。 This doesn't appear to cause any problem. 这似乎没有引起任何问题。 Now I add a new app, base, which is run as simply http://example.com . 现在,我添加了一个新的基本应用程序,该应用程序可以简单地通过http://example.com运行。 (No sub-path.) It also adds a UrlRoutingHandler. (无子路径。)它还添加了一个UrlRoutingHandler。 And once I add this app, foo and bar are no longer accessible. 一旦添加了此应用程序,就不再可以访问foo和bar。 Any attempt to reach them gives error 500. 尝试达到这些目标都会导致错误500。

Can someone give me some clues as to what's happening? 有人可以给我一些线索吗? Does the web.config of an app at route get "added to" the web.config of a "sub" app, but web.configs in "peer" apps don't affect each other? 路由中的应用程序的web.config是否会“添加”到“子”应用程序的web.config中,但“对等”应用程序中的web.config不会互相影响?

I renamed the handler in the base app and it looks like that works. 我在基本应用程序中重命名了处理程序,看起来像这样。 But "it works and I don't know why" is only a little better than "it doesn't work and I don't know why". 但是,“它有效,我不知道为什么”仅比“它无效,我不知道为什么”好一点。

The Web.config always includes whatever is at their parent level. Web.config始终包含其父级别的任何内容。 You can override, or remove, but it's always the sum of everything from the machine.config all of the way up to the most nested web.config. 您可以覆盖或删除,但这始终是从machine.config一直到嵌套最多的web.config的所有内容的总和。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM