Wednesday, March 28, 2012

Web.Config Inheritance and Mixing .Net 1.1 and 2.0 Apps

The problem I have with the automatic inheritance of Web.Config settings. I have an application in the root directory of my website, and I have just converted this to a .Net 2.0 application - and there are the .Net 2.0 specific directives in it's Web.Config file. But, there are quite a few .Net 1.1 applications in several of the subdirectories - and when they start, they automatically read the root folder's Web.Config - which contains 2.0 specific stuff, and it objects.

How can I stop this automatic inheritance behavior? Can a <location path="."> work? What should the path value be to just specify this top level directory?

you'll have to set the subdirectories to be their own Applications within IIS. This will isolate them though... which means they wont share sessions either... but if that's not an issue you should be set with that change.


Okay, I can understand the concept of the separate application. But how do I set this? On the "properties" tab in IIS6 for each directory, they have a different application name (the default name when the directory is created as an application directory). As well, there are two different application pools - one for the .Net 2.0 applications, and another for the .Net 1.1 apps.


We are in the same situation and this solution doesn't work in all cases. The subdirectories (.NET 1.1) inherit the web.config from the parent directory (.NET 2.0) and it produces a "Configuration Error" when the 1.1 framework chokes on 2.0 tags.

Does anyone know of a way to have a child web.config forcibly stop inheritance from the parent? I do not want to turn off all inheritance by setting inheritInChildApplications="false" in the parent web.config.

Thanks!


you'll have to set the subsites as their own Application within IIS. This will make them 100% independant. This will also mean they wont share session with the root...but that's the price you have to pay.


Can you please define "Application"? Each subdirectory is it's own application already. In IIS, the "Application Name" and "Application pool" are completely different from the Root and we are having the problem.

I have a feeling you mean "Web Site" instead of "Application"?


You can stop web.config inheritance by adding

<location path="." inheritInChildApplications="false">
<system.web>
...
</system.web>
</location>

I was able to run asp.net 1.1 application as application folder under asp.net 2.0 root application

0 comments:

Post a Comment