简体   繁体   中英

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. Hosted by this site is a child Application built using ASP.Net 2.0, with its own app pool.

<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. 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.

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 .

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:

<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? Assuming so, is the CLR attempting to run it as a 2.0 app (ie backwards compatibility)? Or is it simply assuming it is a 4.0 web app (seems dangerous)?

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? If so, is this all that is needed to safely run an ASP.Net 2.0 application under an ASP.Net 4.0 site?

I have used scenario #2 many times and never had any problems. So yes this is all that is needed to safely run an ASP.Net 2.0 application under an ASP.Net 4.0 site.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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