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:05

I had to register ASP.Net in IIS to get it resolved in the Windows Server 2008 R2. Sreenshot of the commands attched below

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 

enter image description here

查看更多
栀子花@的思念
3楼-- · 2019-01-01 15:05

To fix this problem simply click the ASP.NET Version icon in the Site Tools section of Control Panel to switch the framework to 4.0.

查看更多
弹指情弦暗扣
4楼-- · 2019-01-01 15:05

Just had this issue deploying a new app to an old IIS box. The investigation led to the v4.5.1 run-time being installed but the app requiring v4.5.2

Nothing apart from installing the correct version of ASP .Net run-time was required.

查看更多
长期被迫恋爱
5楼-- · 2019-01-01 15:07

Registering the framework with IIS is what worked for me:

C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis -i
查看更多
余生无你
6楼-- · 2019-01-01 15:07

Create a new pool by selecting .Net Framework v4.0.3xxxxx

use the Manage Pipeline Mode: Integrated

Assign it to your site and done.

查看更多
孤独寂梦人
7楼-- · 2019-01-01 15:08

Saw the error "Unrecognized attribute 'targetFramework'" in the 'Console output' page of Jenkins on a build server. This was after I changed the 'target framework' for several projects from '.NET Framework 3.5' to '.NET Framework 4' and committed my changes.

In Jenkins the project settings had to be changed. For the solution the 'MSBuild Version' had to be changed from 'v3.5' to 'v4.0'.

查看更多
登录 后发表回答