无法识别的属性'targetFramework'.在4.0站点与2.0子文件夹?

ctr*_*yan 1 iis .net-4.0

我最近将网站升级到.net 4.0.我更改了应用程序池,几乎一切都正常.

但是,由于某种原因,位于"admin"子文件夹中且具有自己的web.config的站点的管理部分仍然在2.0下运行.当我左键单击IIS中的子目录并检查属性的ASP.net选项卡时,它获得ASP.NET版本2.0.50727.

如果我单击"编辑配置",我会收到此错误"尝试读取配置时出现错误".错误消息是:

无法识别的属性'targetFramework'.请注意,属性名称区分大小写.

受保护的Web配置直接看起来像这样

<?xml version="1.0"?>
<!-- 
    Note: As an alternative to hand editing this file you can use the 
    web admin tool to configure settings for your application. Use
    the Website->Asp.Net Configuration option in Visual Studio.
    A full list of settings and comments can be found in 
    machine.config.comments usually located in 
    \Windows\Microsoft.Net\Framework\v2.x\Config 
-->
<configuration>
    <appSettings/>
    <connectionStrings/>
    <system.web>
        <authorization>
            <deny users="?"/>
        </authorization>
        <customErrors mode="Off"></customErrors>
    </system.web>
</configuration>
Run Code Online (Sandbox Code Playgroud)

当我尝试导航到管理部分时,我得到"服务器应用程序不可用",并且应用程序日志中的条目抱怨两个不同的版本.

一切都在4.0的同一个应用程序池下运行.为什么子文件夹不是4.0,我该如何解决?

Nar*_*aen 5

您运行的是哪个版本的IIS?

我的猜测是,在某些时候,您(或其他人)在子文件夹上手动将ASP.NET版本设置为2.0.

它的工作方式...... IIS检查是否未设置该值.如果未设置,则它继承父项的值.一旦明确设置了值,更改父级的值就不会级联到子级.