IIS发布WCF问题

Server Error in '/' Application.


Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive.
Source Error:

Line 3:  
Line 4:    <system.web>
Line 5:      <compilation debug="false" targetFramework="4.0" />
Line 6:    </system.web>
Line 7:    <system.serviceModel>

Source File: C:\inetpub\wwwroot\EvalserviceSite\web.config    Line: 5


Version Information: Microsoft .NET Framework Version:2.0.50727.5448; ASP.NET Version:2.0.50727.5456

发生上面问题的主要原因是当前vs工程使用的时.NET4.0的版本,而IIS上默认的该website的.Net Framework Version 是低于4.0的版本

打开 IIS: 自己电脑名字 -> Application Pools ->website名字->右键单击->选择“Basic setting...” -> “.Net Framework version”(选择 .Net Framework v4.0)->确定。

如果不起作用关掉IIS,重新打开一下

Open  IIS: "My computer name" -> Application Pools -> your website name(.Net Framework Version)->right click->Basic setting... -> .Net Framework version(select .Net Framework v4.0)->OK

如果想一劳永逸那就直接选择“Set Application Pool Default...”,在里面的 ”.Net Framework version“选择"v4.0",关闭IIS重新打开全部会设置为4.0版本的.NET Framework version。

原文地址:https://www.cnblogs.com/BoyceYang/p/2473551.html