Freigeben über


Making nested ASP.NET applications work !

Have you ever tried to set up a web site and use 2 popular ASP.NET applications ?

Did you get THIS ?

I did.

I set up BlogEngine.net in c:\inetpub\wwwroot - it worked fine !

Then I set up ScrewTurnWiki in c:\inetpub\wwwroot\wiki.

Now, ScrewTurnWiki is really simple to install and it's always worked for me before but this install failed (though as you'll see the problem is ASP.MET and the applications.)

The error messages that I was getting when trying to load the wiki were about not being able to resolve a BlogEngine.net assembly !

The problem is this......

ASP.NET applications have a distinct and complete configuration hierarchy. This is very useful if you are taking advantage of it, but can be a real pain if you are not.

The application in the subordinate directory inherits the entries from the root application. So, extensions, handlers, providers, etc.

The solution is a little counterintuitive. You would think that you could tell the subordinate application (Wiki) to ignore any configuration changes that are made higher up in the hierarchy, but you can't.

You need to tell the root application not to send configuration to any subordinate applications.

It looks something like this.

<configuration>
    <configSections>
        ...
    </configSections>
    <location path="." inheritInChildApplications ="false">
        ... rest of config
    </location>
</configuration>

Many thanks to Nikhil and Clint for the data !