Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.Net using wrong web.config for virtual directory

We're running IIS 6 on Windows Server 2003 R2.

We want to add a virtual directory that runs under .NET 4.0 to a site that runs under .NET 2.0. We've given the virtual directory its own app pool, and we've configured the virtual directory to run under 4.0.

The parent site works fine, but the virtual directory throws errors that reference the parent site's web.config file. We need the virtual directory to use its own web.config file.

The GUI in the IIS Manager says that the virtual directory is using its own web.config file, but the error messages we get refer to items in the parent's web.config file.

I'm not sure how to solve the problem. My best lead so far is from a post on another site said that the problem could be solved with something like this:

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

Again, I'm not sure this will fix things, and I'm not sure how to figure out where to put it or what it ought to contain. The parent site is built on top of a CMS system, and its web.config file is reasonably complex.

like image 618
Alex Strasheim Avatar asked Feb 20 '23 18:02

Alex Strasheim


1 Answers

I got this to work, so I want to leave the answer for the next person.

The location tags I mentioned in my question did the job. I got them to work by using them to enclose a system.web section:

<location path="." inheritInChildApplications="false">
  <system.web>
    .
    .
   (the stuff that made the site in the virtual directory break)
    .
    .
  </system.web>
 </location>
like image 154
Alex Strasheim Avatar answered Mar 19 '23 07:03

Alex Strasheim