How to use a .NET 4.0 web application within a .NET 3.5 web application?

前端 未结 6 826
既然无缘
既然无缘 2021-02-08 14:57

My company has a website built in ASP.NET and targets .NET 3.5. It is too mangled and massive to be converted to .NET 4 in a timely manner. I am tasked with building a ticketing

相关标签:
6条回答
  • 2021-02-08 15:14

    Web.config inheritance is unfortunately not something you can turn off completely; Specifically, the top section in the web.config that defines which config sections exist in the web.config cannot be ignored/overridden inside a child application.

    The solution is documented here(asp.net 4 breaking changes documentation); Essentially you have to move the values that are currently in the top application up into a machine/FrameworkVersion specific config file and then wrap all(or at least, most) of your root web.config in a location tag with inheritence disabled.

    0 讨论(0)
  • 2021-02-08 15:17

    Assuming that your current site uses AppPool1 targeted to .NET 2.0

    Create AppPool2, target it to .NET 4.0 and use it by virtual dir of your app.

    0 讨论(0)
  • 2021-02-08 15:18

    Have you tried setting the "inheritInChildApplications" attribute to "false" in the parent folder's web.config file?

    See Saul Dolgin's answer to a similar question for how to do this.

    0 讨论(0)
  • 2021-02-08 15:20

    Edit: As mentioned first port of call is to make sure each application has it's own application pool. Double and triple check this as a .net 3.5 site and a .net 4 site in the same app pool will cause the entire app pool to break.

    Next, try remove the entire scripting section group, from my experience it solves it and i've not noticed any problems

    0 讨论(0)
  • 2021-02-08 15:26

    Make sure that stuff isn't in the machine config for the app pool. If so, just delete it from your web config.

    0 讨论(0)
  • 2021-02-08 15:39

    In my applications I more or less succeed with nested applications by using the <location> element together with <clear /> and similar elements in the web.config.

    This is an excerpt from a web.config file of mine:

    ...
    <!-- Do not inherit. -->
    <location path="." inheritInChildApplications="false">
        <system.web>
            ...
    

    The idea is to put all sections that you do not want to inherit to child applications within those location elements, as in my example above.

    0 讨论(0)
提交回复
热议问题