无法识别的属性"目标框架"属性名称区分大小写



这是一个常见的错误,在这里已经多次讨论。但是在将我发送给其他答案之前,请阅读以下情况。这不是针对目标的错误框架的情况。

编辑:如果web.config目标" 4.0"或" 4.0.3",则会发生错误。

在Visual Studio 2010(在Win 7 X64上),我进入了高级编译选项,并从目标框架下拉列表中选择了"安装其他框架"。此过程从Microsoft网站下载4.0.3框架。安装过程需要几分钟,需要重新启动。我下载,安装和重新启动。

然后,我进入了Visual Studio 2010中的应用程序,以4.0.3的框架为目标,此步骤要求该项目要关闭并重新开放,我做到了。然后,我重建了该项目。我可以在Visual Studio中成功运行该应用程序。然后我发布了该应用程序。但是它不能直接在浏览器中运行。我在下面得到错误。只是为了确保,我在遇到错误后重新注册了框架,但没有欢乐:

cd C:WindowsMicrosoft.NETFrameworkv4.0.30319
iisreset /stop
aspnet_regiis -i
iisreset /start

======================================
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. 
Parser Error Message: Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive.
Source Error: 

Line 9:    </connectionStrings>
Line 10:   <system.web>
Line 11:     <compilation strict="false" explicit="true" targetFramework="4.0.3" />
Line 12:     <authentication mode="None" />
Line 13:     <membership>

您对targetFramework输入的值,4.0.3无效。

来自<compilation>元素上的文档:

targetFramework="2.0|3.0|3.5|4.0"

所以,只需丢弃.3即可。

最新更新