简体   繁体   中英

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. 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. 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. 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".

That is, say we have existing apps foo and bar run as http://example.com/foo and http://example.com/bar . Both foo and bar add a handler called "UrlRoutingHandler". This doesn't appear to cause any problem. Now I add a new app, base, which is run as simply http://example.com . (No sub-path.) It also adds a UrlRoutingHandler. And once I add this app, foo and bar are no longer accessible. Any attempt to reach them gives error 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?

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. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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