无法识别的属性“targetFramework”。在4.0站点2.0分文件夹?文件夹、属性、无法识别、站点

2023-09-08 09:45:46 作者:抬头望天空、放肆的微笑

我最近升级的站点到.NET 4.0。我改变了应用程序池,几乎一切工作正常。

I have recently upgraded a site to .net 4.0. I changed the app pool and almost everything is working properly.

然而这是在一个管理员的子文件夹具有自身的web.config网站的管理部分被仍在2.0出于某种原因运行。当我离开单击子目录中的IIS和检查属性的ASP.net标签中,得到ASP.NET版本2.0.40607。

However the admin section of the site which is in an 'admin' subfolder with its own web.config is still running under 2.0 for some reason. When I left click the sub directory in IIS and check the ASP.net tab of properties it get ASP.NET version 2.0.50727.

如果我点击编辑配置我得到这个错误 发生错误attemping读取配置。错误消息是:

If i click 'Edit Configuration' I get this error "An error has occured attemping to read the configuration." The error message is:

无法识别的属性targetFramework。注意属性名称是区分大小写的。

Unrecognized attribute 'targetFramework'. Note the attribute names are case-sensitive.

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

The web config in the protected directly looks like this

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

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

When I try to navigate to the admin section i get "Server Application Unavailable" and an entry in the app log complaining about two different versions.

一切都在同一个应用程序池是4.0上运行。为什么子文件夹不是4.0,如何解决呢?

Everything is running under the same app pool which is 4.0. Why is the sub folder not 4.0 and how do I fix it?

推荐答案

您运行的是什么版本的IIS?

What version of IIS are you running?

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

My guess, is that at some point, you (or somebody else) manually set the ASP.NET version to 2.0 on the subfolder.

它的工作方式...... IIS检查,看看是否值未设置。如果没有设置,它继承父值。一旦该值被明确设置改变在父值不级联到子

The way it works... IIS checks to see if the value is not set. If it is not set, it inherits the value from the parent. Once the value is set explicitly changing the value at the parent does not cascade to the child.