Search code examples
c#iis-7configurationblogengine.net

How do I configure this IIS 7.5 child application properly?


I have a parent application hosted in the root folder of my website. It's a .NET 4.0 application and the application pool is obviously set to 4.0.

I want to configure a child application at:

/blog

This is a .NET 2.0 application (it's BlogEngine.NET). I created a new virtual directory called "blog", pointed it at the appropriate directory, converted it to an application and put it in it's own application pool set to .NET Framework 2.0.

I edited the parent web.config and added:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <location path="." inheritInChildApplications="false">
      <configSections>
         <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
    </configSections>
  ....entire web.config basically...
  </location>
</configuration>

Right after the element. However, when I go to http://localhost/blog, I get the following error:

The configuration section 'configSections' cannot be read because it is missing a section declaration

Anyone have any ideas what's going on here or what I might be missing?


Solution

  • Unfortunately this is a downfall of the way IIS handles virtual directories. Your parent application's web.config is still read even though it's not in the child application. I tried to nest a 4.0 app as a child of a 3.5 app before and after several days of frustration, SO questions, and forum posts, I finally came to the conclusion that it was more trouble than it was worth.