Restful WCF 4.0 IIS 7.5错误

问题描述:

我一直在试图做一个简单的restful wcf服务,将返回JSON。它的工作如果我将在开发服务器上运行它。但是,如果我在IIS 7.5中部署它,我都会有这样的错误,当我把它用http://localhost:70Restful WCF 4.0 IIS 7.5错误

访问HTTP错误500.19 - 内部服务器 错误请求的页面无法 访问,因为相关 配置数据该页面是 无效。

配置错误配置节 “standardEndpoints”无法读取 ,因为它缺少一个部分 声明

这里是我的配置文件:这是由VS2010生成的默认文件。

<?xml version="1.0"?> 
<configuration> 

    <system.web> 
    <compilation debug="true" targetFramework="4.0" /> 
    </system.web> 

    <system.webServer> 
    <modules runAllManagedModulesForAllRequests="true"> 
     <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> 
    </modules> 
    </system.webServer> 

    <system.serviceModel> 
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true"/> 
    <standardEndpoints> 
     <webHttpEndpoint> 
     <!-- 
      Configure the WCF REST service base address via the global.asax.cs file and the default endpoint 
      via the attributes on the <standardEndpoint> element below 
     --> 
     <standardEndpoint name="LocationService" helpEnabled="true" automaticFormatSelectionEnabled="true"/> 
     </webHttpEndpoint> 
    </standardEndpoints> 
    </system.serviceModel> 

</configuration> 

Im新的WCF特别在.net 4.0和IIS 7.5上。

任何人都可以帮忙吗?或者任何人都经历过相同的并且已经修复过?

您是否确定已将IIS应用程序池配置为使用ASP .NET 4.0运行?

右键单击您的虚拟目录在IIS管理器>管理应用程序>高级设置>读取应用程序池名称。

然后转到应用程序池,找到该名称并确保.NET Framework专栏显示v4.0。

+0

感谢这个人,我已经检查并发现我的应用程序创建了使用asp.net 2.0而不是4.0的自己的应用程序池。现在它的工作。非常感谢你。 – 2010-09-13 23:58:38

+0

非常感谢! – 2012-03-09 21:02:37

我在运行.net 4.0的应用程序池的w2008 x64上发生同样的错误;安装SP2后,问题消失

不好意思问这个可能似乎是显而易见的一些问题,但它可能会帮助别人(主要是我),如果你能澄清的最后一步:

然后去应用程序池.. 。

我在哪里可以找到应用程序池?

如果你不能说我习惯为其他人为我做这件事的大公司工作,现在我正在担任开发人员和IT总监。

感谢

好吧,以后的研究9秒(我睁开眼睛)看着正上方的网站在IIS管理器

enter image description here

这个问题可以在Windows Server 2008上看到无服务包2安装。要解决该问题,请安装Windows Server 2008 Service Pack 2。

Ram Poornalingam's WebLog entry from the 26th October 2009摘自:

如果遇到以下错误在你的web应用程序(托管在IIS中的东西)“配置部分无法读取,因为它缺少一个部分声明”

例子

“配置节‘standardEndpoints’不能读,因为它缺少一个部分声明”

配置节“跟踪”不能读,因为它缺少一个部分声明”

那么你需要安装Vista/Win2k8任SP2或KB文章中提到的修补程序958854.

+0

这正是我们在将一些旧的x86应用程序服务器从IIS 6(2003)升级到IIS 7(2008 SP2)后面临的问题。感谢您分享修复! – SliverNinja 2015-02-23 10:00:39