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

In IIS

Click on Application Pools

Right Click on DefaultAppPool --->> Set Application Pool Default....--->>Change .Net Version to V 4.0.

查看更多
大哥的爱人
3楼-- · 2019-01-01 15:20

I was facing the same issue while publishing my 1'st web services. I resolved it by simply doing this:

  1. Open IIS

  2. Click on Application Pools

  3. Right Click on DefaultAppPool => Set Application Pool Default => Change .Net Version to V 4.0. (You can also change .Net Framework Version of your application specifically)

Hope, it'll work.

查看更多
公子世无双
4楼-- · 2019-01-01 15:21

Follow these two steps:

Register the .net framework version version 4.0 (if it is not registered)

  1. C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis -i

  2. In the app pool change the .net framework to v4.0

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

Open Project -> press Shift + F4 (Open properties page) -> Chose Build -> in Target Framework chose .NET Framework 4 -> OK

查看更多
忆尘夕之涩
6楼-- · 2019-01-01 15:24

What I did: I did change the value of Application Pool to DefaultAppPool from a previous value. You do this in the Advanced Settings (Website --> Manage Website --> Advanced Setting>.

查看更多
谁念西风独自凉
7楼-- · 2019-01-01 15:24

I had the same issue and I found this nice poweshell script to update all of your app pools at the same time: https://gallery.technet.microsoft.com/scriptcenter/How-to-set-the-IIS-9c295a20

Make sure to set you $IISAppPoolDotNetVersion = "v4.0" variable at the top.

查看更多
登录 后发表回答