一个IIS站点,两个具有不同.NET版本的应用程序 [英] One IIS site, Two applications with different .NET versions

查看:142
本文介绍了一个IIS站点,两个具有不同.NET版本的应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将一个旧站点移植到MVC 4中,到目前为止,它已经可以工作了.但是,还有一个我们不变的第三方论坛.在IIS 7中,我为论坛创建了一个新的应用程序,它也有自己的应用程序池(MVC是.NET4,论坛是.NET 2).

I porting an old site into MVC 4 and I have it working so far. However there is also a third party forum which we use which isn't changing. In IIS 7 I created a new Application for the forum and it also has its own app pool (MVC is .NET4 and forum is .NET 2).

应用程序位于服务器上的不同物理目录中,这是IIS目录结构的样子,其中ForumApp是子应用程序:

The applications are in different physical directories on the server, and here's what the IIS directory structure looks like with ForumApp being the sub-application:

\ RootMVCSite \
\ RootMVCSite \ bin
\ RootMVCSite \ [OTHERMVCFILESANDFOLDERS]
\ RootMVCSite \ web.config
\ RootMVCSite \ ForumApp \
\ RootMVCSite \ ForumApp \ bin
\ RootMVCSite \ ForumApp \ [OTHERFORUMAPPFILESANDFOLDERS]
\ RootMVCSite \ ForumApp \ web.config

\RootMVCSite\
\RootMVCSite\bin
\RootMVCSite\[OTHERMVCFILESANDFOLDERS]
\RootMVCSite\web.config
\RootMVCSite\ForumApp\
\RootMVCSite\ForumApp\bin
\RootMVCSite\ForumApp\[OTHERFORUMAPPFILESANDFOLDERS]
\RootMVCSite\ForumApp\web.config

但是,当我进入论坛时,出现以下错误:

However, when I go to the forum I get the following error:

Parser Error Message: Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive.

Line 20:   <system.web>
Line 21:     <compilation targetFramework="4.0" />

令人困惑的部分是,它正在web.config中查找MVC根站点,而不是子应用程序指向的论坛站点.我需要在IIS或web.config中做什么以解决此问题?有没有一种方法可以防止子应用查看根站点的web.config?

The confusing part is that it is looking in the web.config for the root MVC site rather than the forum site where the sub-application is pointing. What do I need to do in IIS or web.config to fix this? Is there a way to prevent the sub-app from looking at the root site's web.config?

推荐答案

我知道了.通过用location标签包装有问题的配置部分,所有子应用程序都将忽略这些设置.

I figured it out. By wrapping the offending configuration sections with the location tag, those settings would be ignored by any child applications.

<location path="." inheritInChildApplications="false">
  <system.web>
    <compilation targetFramework="4.0" />
  </system.web>
  ...
</location>

如果对于此解决方案我有什么需要警惕的地方,请及时提出并提出任何改进或建议!

If there's anything I should be wary of regarding this solution, please chime in and suggest any improvements or advice!

这篇关于一个IIS站点,两个具有不同.NET版本的应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆