Unrecognized attribute 'targetFramework'.

2019-01-01 14:53发布

I'm trying to up load my site and I'm getting this error message:

Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive.

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

The site works fine on my local PC but won't open when I loaded it to my host and tried to view it online.

标签: asp.net
27条回答
唯独是你
2楼-- · 2019-01-01 15:25

Change the application pool to target framework 4.0 instead of classic .

  1. RC website ->manage website->advanced setting>
  2. the first option change from classic to framework 4 integrated.
查看更多
情到深处是孤独
3楼-- · 2019-01-01 15:25

I had this error from a failed MSBuild compile, in a project file converted from an earlier version of VS into VS2010 and .NET 4.0. It was actually a Web Deployment project, and the solution that worked for me was adding the following entries into the PropertyGroup section at the start of the MSBuild file:

<ProductVersion>10.0.11107</ProductVersion>

<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>

Maybe these get automatically updated when other types of project are converted in VS2010, but they were missing from my Web Deployment project file after it was converted.

查看更多
残风、尘缘若梦
4楼-- · 2019-01-01 15:26

Just had this in VS 2010.

Fixed by editing the .sln file and changing the TargetFrameworkMoniker to have the value ".NETFramework,Version%3Dv4.0" assigned to it.

查看更多
人间绝色
5楼-- · 2019-01-01 15:28

It could be that you have your own MSBUILD proj file and are using the <AspNetCompiler> task. In which case you should add the ToolPath for .NET4.

<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>
查看更多
回忆,回不去的记忆
6楼-- · 2019-01-01 15:28

For anyone having this who doesn't have IIS running on their dev PC, here's what happened to me: I had one website on, overwrote with files from a diff website that was 4 while the previous was 3.5. Got this error. Fixed it simply by changing the directory name of the website, which on a dev PC can be anything, so no problem. The above are probably more elegant to be sure, but sometimes simple works, IF you can get away with it, i.e., you're in dev rather than QA or Prod.

查看更多
时光乱了年华
7楼-- · 2019-01-01 15:29

For layering, Just change the version of targetFramework in web.config file only, the other things no need change.

查看更多
登录 后发表回答