IIS7/Win7 .Net 4.0中ASP.Net网站的运行时问题

问题描述:

在VS2010中,该项目的目标框架为4.0。 在IIS7中,localhost的.Net版本是4.0。 但是对于我的应用程序的应用程序池,没有4.0框架可供选择。 后,我部署站点和浏览来自它的文件时,我得到这个错误:IIS7/Win7 .Net 4.0中ASP.Net网站的运行时问题

Parser Error Message: Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive. 

Source Error: 

Line 14: 
Line 15: <system.web> 
Line 16:  <compilation debug="true" targetFramework="4.0" /> 
Line 17: 
Line 18:  <authentication mode="Forms"> 


Source File: C:\inetpub\wwwroot\TestApp\web.config Line: 16 

Version Information: Microsoft .NET Framework Version:2.0.50727.4927; ASP.NET Version:2.0.50727.4927 

请帮助我。

感谢 雷迪

您应该在服务器上安装.net 4运行时。 如果您已经运行过aspnet_regiis.exe

+0

我在开发机器上部署应用程序本身。虽然在调试时它工作正常。这是不是说我安装了.NET FW 4.0运行时? – 2010-08-04 05:29:07

+0

在调试过程中,您可能使用的是不是IIS的web服务器中内置的VS。运行aspnet_regiis.exe – Jeroen 2010-08-04 12:58:32

你需要在服务器上安装.NET 4.0。安装完成后,您可以将应用程序池设置为使用.Net 4.0框架。

错误消息显示它正在尝试使用无法处理您的web.config文件的.Net 2.0运行您的应用程序。

如果.Net 4.0可用,请转到服务器IIS管理器并选择“应用程序池”,并为您的网站创建.Net框架4.0。