如何将子应用程序与IIS7上的主站点隔离

时间:2022-09-25 12:36:25

Senario:

情形:

I'm running IIS7 on Win Server 2008 Web Edition

我在Win Server 2008 Web Edition上运行IIS7

I have a MVC application at the route of the website (main app)

我在网站的路线上有一个MVC应用(主应用)

The website HOST is domain.com

网站的主持人是domain.com

I've created a virtual application /testapp with has an ASP.Net application (sub app)

我创建了一个带有ASP的虚拟应用/testapp。网络应用程序(子程序)

Problem:

问题:

when I navigate to http://domain.com the main app works as expected but when I navigate to http://domain.com/testapp the sub app seems to be running but processing the main app web.config.

当我导航到http://domain.com时,主应用程序按预期运行,但当我导航到http://domain.com/testapp时,子应用程序似乎在运行,但处理主应用程序web.config。

Some of the errors I was getting involved missing dlls that only the main app required - this could be solved by copying the dlls into the sub app bin folder but isn't an ideal solution.

我遇到的一些错误是缺少了只有主应用程序需要的dll——这可以通过将dll复制到子应用程序bin文件夹中来解决,但这不是一个理想的解决方案。

Question:

问题:

I don't think this is an MVC/ASP.Net issue but instead an ISS7 one. How do I configure IIS7 so that these two application don't interfere with each other?

我不认为这是MVC/ASP。净问题,而不是ISS7。如何配置IIS7,使这两个应用程序互不干扰?

2 个解决方案

#1


2  

This problem is by design due to inheritance of web.config files. You have a couple of solutions:

这个问题是由于网络的继承造成的。配置文件。你有几个解决方案:

  1. Move the site elements at the root of the site into a application subfolder that sits side by side with your other application and remove as much of the parent's web.config as possible.
  2. 将站点的根目录中的站点元素移动到与其他应用程序并列的应用程序子文件夹中,并删除父类web的尽可能多的内容。配置。
  3. Copy all the elements in the parent web.config to the child web.config that are needed and use the location elements to block inheritance in the child:
  4. 复制父web中的所有元素。配置到子web。需要的配置,并使用位置元素来阻止子元素的继承:
< location path="." inheritInChildApplications="false" >
    < system.web >
    ...
    </ system.web >
</ location >

#2


0  

I had similar problem when I've add custom modules in my ASP MVC 4 application running on IIS7. I've found a solution by simply removing and adding the module as so:

当我在IIS7上运行的ASP MVC 4应用程序中添加自定义模块时,我遇到了类似的问题。我已经找到了一个解决方案,只需简单地删除和添加模块:

 <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <modules runAllManagedModulesForAllRequests="true">
      <remove name="GlobalizationModule"/>
      <add name="GlobalizationModule" type="GlobalizationHttpModule, MyWebSite"/>
    </modules>
  </system.webServer>

It is specific solution to this problem, hope it helps.

这是解决这个问题的具体办法,希望能有所帮助。

Ido.

被罩。

#1


2  

This problem is by design due to inheritance of web.config files. You have a couple of solutions:

这个问题是由于网络的继承造成的。配置文件。你有几个解决方案:

  1. Move the site elements at the root of the site into a application subfolder that sits side by side with your other application and remove as much of the parent's web.config as possible.
  2. 将站点的根目录中的站点元素移动到与其他应用程序并列的应用程序子文件夹中,并删除父类web的尽可能多的内容。配置。
  3. Copy all the elements in the parent web.config to the child web.config that are needed and use the location elements to block inheritance in the child:
  4. 复制父web中的所有元素。配置到子web。需要的配置,并使用位置元素来阻止子元素的继承:
< location path="." inheritInChildApplications="false" >
    < system.web >
    ...
    </ system.web >
</ location >

#2


0  

I had similar problem when I've add custom modules in my ASP MVC 4 application running on IIS7. I've found a solution by simply removing and adding the module as so:

当我在IIS7上运行的ASP MVC 4应用程序中添加自定义模块时,我遇到了类似的问题。我已经找到了一个解决方案,只需简单地删除和添加模块:

 <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <modules runAllManagedModulesForAllRequests="true">
      <remove name="GlobalizationModule"/>
      <add name="GlobalizationModule" type="GlobalizationHttpModule, MyWebSite"/>
    </modules>
  </system.webServer>

It is specific solution to this problem, hope it helps.

这是解决这个问题的具体办法,希望能有所帮助。

Ido.

被罩。