Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/328.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Asp.net MCV4框架问题_C#_Asp.net_Asp.net Mvc 4 - Fatal编程技术网

C# Asp.net MCV4框架问题

C# Asp.net MCV4框架问题,c#,asp.net,asp.net-mvc-4,C#,Asp.net,Asp.net Mvc 4,我使用VS 2012和MVC4创建了一个网站,这是我的本地主机的工作方式,但当我发布并放置我的主机时,它不工作。IIS确认是相同的。但它给了我这样的错误: 这是错误的 Configuration Error Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error d

我使用VS 2012和MVC4创建了一个网站,这是我的本地主机的工作方式,但当我发布并放置我的主机时,它不工作。IIS确认是相同的。但它给了我这样的错误:

这是错误的

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: The 'targetFramework' attribute in the <compilation> element of the Web.config file is used only to target version 4.0 and later of the .NET Framework (for example, '<compilation targetFramework="4.0">'). The 'targetFramework' attribute currently references a version that is later than the installed version of the .NET Framework. Specify a valid target version of the .NET Framework, or install the required version of the .NET Framework.

Source Error: 


Line 20:   </appSettings>
Line 21:   <system.web>
Line 22:     <compilation targetFramework="4.5" />
Line 23:     <httpRuntime targetFramework="4.5" />
Line 24:     <authentication mode="Forms">

提前感谢您的建议

您必须在IIS中将应用程序池更新为.net 4.0。它目前可能设置为2.0。

可能是IIS没有安装4,或者是没有指定站点使用它。假设您正在运行IIS7,请查看以下帖子:


我在服务器上安装nopCommerce 2.80时遇到了类似的问题。 我使用IIS7网络。4.0集成池。刚刚从WebMatrix产品->框架部分安装了.NET4.5。需要重新启动。
然后它开始工作。

将此标签更改为4.0:

<compilation targetFramework="4.0" />
并删除此标记:

<httpRuntime targetFramework="4.5" />

您只需在IIS 7.5服务器中将.NET framework升级到4.5版即可。您可以使用Microsoft web安装程序执行此操作。搜索.NET,然后安装.NET framework 4.5版,所有针对该版本的应用程序都将正常工作。

您必须安装.NET framework 4.5,然后它将正常工作。.net framework 4.0无法识别targetframework属性。因此,在命令提示符下运行以下命令,并检查是否在主机上安装了.net 4.5版。如果没有,则安装.net framework 4.5。它将正常工作。 在cmd上运行此命令,如下所示

wmic /namespace:\\root\cimv2 path win32_product where "name like '%%.NET%%'" get version
运行以下命令:

如果需要针对从internet上防火墙隔离的服务器运行,请确保以脱机模式运行。
我不是这方面的专家,但这真的是全部错误吗?你的服务器上安装了.NET 4.5吗?我刚刚安装了,它肯定能工作,谢谢你的建议。只是有同样的问题,并意识到httpRuntime是阻塞的块。