简体   繁体   English

在具有4.0应用程序池的站点下运行的具有2.0应用程序池的子应用程序

[英]Child Application with 2.0 App Pool running under a Site with a 4.0 App Pool

Scenario 情境

I have an IIS Site application built using ASP.Net 4.0, running with its own app v4.0 app pool. 我有一个使用ASP.Net 4.0构建的IIS站点应用程序,并以其自己的应用程序v4.0应用程序池运行。 Hosted by this site is a child Application built using ASP.Net 2.0, with its own app pool. 此站点托管的是使用ASP.Net 2.0构建的子应用程序,具有其自己的应用程序池。

<site name="Intranet" id="1" serverAutoStart="true">
    <application path="/" applicationPool="Site-Intranet">
        <virtualDirectory path="/" physicalPath="D:\sites\intranet" />
    </application>
    <application path="/ChildApp" applicationPool="App-ChildApp">
        <virtualDirectory path="/" physicalPath="D:\apps\childapp" />
    </application>
</site>

My first thought is that the 2.0 Application should run using a v2.0 app pool. 我的第一个想法是2.0应用程序应使用v2.0应用程序池运行。 visiting the URL when doing so causes a server error -- it does not recognize the "targetFramework" attribute in the parent Site's web.config compilation settings. 这样做会导致服务器错误-无法访问父站点的web.config编译设置中的“ targetFramework”属性。

I understand why, and have found two solutions/workarounds, but I do not fully understand the implications of each one. 我理解原因,并且找到了两种解决方案/解决方法,但是我不完全理解每种解决方案/解决方案的含义。

Fixes 修正

1. Set Application's app pool as v4.0 . 1.将应用程序的应用程序池设置为v4.0

2. Leave the Application's app pool as v2.0 , but change the parent Site's web.config to break inheritance on the <compilation> section: 2.将应用程序的应用程序池保留为v2.0 ,但更改父站点的web.config来破坏<compilation>部分上的继承:

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

Question(s): 问题:

What's really going on with these fixes/solutions? 这些修复程序/解决方案实际上是怎么回事?

In scenario #1, is the 2.0 Application being compiled/run by the 4.0 CLR? 在方案1中,2.0应用程序是否由4.0 CLR编译/运行? Assuming so, is the CLR attempting to run it as a 2.0 app (ie backwards compatibility)? 假设是这样,CLR是否尝试将其作为2.0应用程序运行(即,向后兼容)? Or is it simply assuming it is a 4.0 web app (seems dangerous)? 还是只是假设它是4.0 Web应用程序(似乎很危险)?

In scenario #2, I know we have stopped the child app from seeing the targetFramework attribute, but is the 2.0 CLR truly compiling/running the application? 在场景2中,我知道我们已经阻止子应用程序看到targetFramework属性,但是2.0 CLR是否真正在编译/运行该应用程序? If so, is this all that is needed to safely run an ASP.Net 2.0 application under an ASP.Net 4.0 site? 如果是这样,这是在ASP.Net 4.0站点下安全运行ASP.Net 2.0应用程序所需要的吗?

I have used scenario #2 many times and never had any problems. 我已经多次使用方案2,但从未遇到任何问题。 So yes this is all that is needed to safely run an ASP.Net 2.0 application under an ASP.Net 4.0 site. 因此, 是的,这就是在ASP.Net 4.0站点下安全运行ASP.Net 2.0应用程序所需要的全部。

Although no one can answer that your two applications will definitely work together this way. 尽管没有人能回答您的两个应用程序肯定会以这种方式一起工作。 Probably best to do a full system test and if you do find any specific problems post a new question. 最好进行完整的系统测试,如果发现任何特定问题,则发布一个新问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM