ASP.Net using wrong web.config for virtual directory

戏子无情 提交于 2019-12-07 08:58:30

问题


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.


回答1:


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>


来源:https://stackoverflow.com/questions/11634939/asp-net-using-wrong-web-config-for-virtual-directory

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!