Asp.net MCV4框架问题

我使用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  element of the Web.config file is used only to target version 4.0 and later of the .NET Framework (for example, ''). 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:  Line 21:  Line 22:  Line 23:  Line 24:  

提前感谢您的建议

将此标记更改为4.0:

  

并删除此标记:

  

我有类似的问题在服务器上安装nopCommerce 2.80。 我使用IIS7网。 4.0集成池。 刚刚从WebMatrix Products-> Frameworks部分安装了.net 4.5。 将需要重新启动。 然后它开始工作。

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

机会是IIS没有安装4(或者如果它没有指定网站使用它)。 假设您正在运行IIS7,请查看此post:

  • 如何在IIS 7,Windows 7上添加ASP.NET 4.0作为应用程序池

您只需要在IIS 7.5服务器中将.NET框架升级到版本4.5,使用Microsoft Web安装程序执行搜索.NET,然后安装.NET框架版本4.5,所有针对该版本的应用程序将工作

运行此: Microsoft .NET Framework修复工具

  • 如果您需要针对从互联网上防火墙的服务器运行,请确保以脱机模式运行。

你必须安装.net framework 4.5然后它将正常工作。 .net framework 4.0无法识别“targetframework”属性。 因此,在命令提示符下运行以下命令,并检查托管计算机上安装的.net版本4.5或不安装。如果不安装.net framework 4.5.it将正常工作。 在cmd上运行此命令,如下所示。

 wmic /namespace:\\root\cimv2 path win32_product where "name like '%%.NET%%'" get version