I have a domain with default top-level site a .Net 2 app. And lots of virtual directories underneath with different apps. I can’t get a .Net 4 virtual directory working.
I have read:
.net 4.0 inheriting .net 3.5 web.config?
and I have a similar issue as: Disable web.config inheritance? which has not been solved – the answers to that question that have been given are to use inheritInChildApplications, which can’t go around the configSections tags.
I’ve managed to stop all .Net 2 subapps of the domain from inheriting the top-level
web.config settings, but for the .Net 4 app I can’t seem to.
<location path="." inheritInChildApplications="false">
is wrapped around the System.Web section of the parent .Net 2 app, and and I have
<clear/>
in every section in the Web.Config of the .Net 4 virtual directory app.
Is there any other solution? Perhaps the parent .Net 2 app could be placed on a virtual directory, and the top-level site request could be URL ReWritten without the user’s knowledge?
No, you can’t stop it inheriting, (the InheritInChildApplications=False fix doesn’t cover enough of the top level Web.Config to fix this issue), but you can remove the top level .Net 2 app and redirect requests.
Using the URL Rewrite module to route requests that would have gone from your top level web application to another “web application” in virtual directory under the web site in IIS, removing almost everything from the top level Web.Config.
No top level .Net 2 app means nothing for the .Net 4 app in a virtual directory to inherit from.
IIS setup before:
Web Site — .net 2 app “root”
|
|– .net 2 app “one”
|– .net 4 app “two”(not working!!)
IIS setup after:
Web Site — rewrite requests to .net 2 app in virtual directory
|
|– .net 2 app “one”
|– .net 4 app “two “
|– .net 2 app “root”