我试图加载我的网站,我得到这个错误消息:

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

<compilation debug="true" targetFramework="4.0">

该网站在我的本地PC上运行良好,但当我将其加载到主机并试图在线查看时,它无法打开。


当前回答

在VS 2010才有。

修正了通过编辑.sln文件并更改TargetFrameworkMoniker值“. net framework,Version%3Dv4.0”分配给它。

其他回答

在IIS

单击应用程序池

右键单击“DefaultAppPool——>>”设置应用程序池默认值....将. net版本更改为V 4.0。

对于分层, 在web中更改targetFramework的版本即可。仅配置文件,其他内容无需更改。

我必须注册ASP。Net,以便在Windows Server 2008 R2中进行解决。下面附有命令的屏幕截图

cd /d C:\Windows\Microsoft.NET\Framework\v4.0.30319

iisreset /stop

aspnet_regiis -i

iisreset /start

%systemroot%\system32\inetsrv\appcmd set config /section:isapiCgiRestriction /[path='%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll'].allowed:True 

%systemroot%\system32\inetsrv\appcmd set config /section:isapiCgiRestriction /[path='%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll'].allowed:True 

可能是你有自己的MSBUILD proj文件,并且正在使用<AspNetCompiler>任务。在这种情况下,您应该为. net4添加ToolPath。

<AspNetCompiler
    VirtualPath="/MyFacade"
    PhysicalPath="$(MSBuildProjectDirectory)\MyFacade\"
    TargetPath="$(MSBuildProjectDirectory)\Release\MyFacade"
    Updateable="true"
    Force="true"
    Debug="false"
    Clean="true"
    ToolPath="C:\Windows\Microsoft.NET\Framework\v4.0.30319\">      
</AspNetCompiler>

打开项目->按Shift + F4(打开属性页)->选择Build ->在目标框架中选择。net Framework 4 -> OK