简体   繁体   English

Restful WCF 4.0上的IIS 7.5错误

[英]IIS 7.5 Error on Restful WCF 4.0

I've been trying to do a simple restful wcf service that will return JSON. 我一直在尝试做一个简单的restful wcf服务,它将返回JSON。 Its working if i will run it in the development server. 它的工作,如果我将在开发服务器中运行它。 However if I deploy it on IIS 7.5, i will have this error when i accessed it using http://localhost:70 但是,如果我在IIS 7.5上部署它,当我使用http:// localhost:70访问它时,我将遇到此错误

HTTP Error 500.19 - Internal Server Error The requested page cannot be accessed because the related configuration data for the page is invalid. HTTP错误500.19 - 内部服务器错误无法访问请求的页面,因为页面的相关配置数据无效。

Config Error The configuration section 'standardEndpoints' cannot be read because it is missing a section declaration 配置错误无法读取配置节'standardEndpoints',因为它缺少节声明

Here is my configuration file: This is the default file generated by the VS2010. 这是我的配置文件:这是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 new to WCF specially on .net 4.0 and IIS 7.5. 我是WCF的新手,特别是在.net 4.0和IIS 7.5上。

Can anybody help? 有人可以帮忙吗? Or anybody has experienced the same and has fixed already? 或者任何人都经历过同样的事情并且已经修好了?

Do you definitely have the IIS application pool for your site configured to run with ASP .NET 4.0? 您的网站的IIS应用程序池是否配置为使用ASP .NET 4.0运行?

Right click your Virtual Directory in IIS Manager > Manage Application > Advanced Settings > read the app pool name. 在IIS管理器中右键单击虚拟目录>管理应用程序>高级设置>读取应用程序池名称。

Then go to Application Pools, find that name and make sure the .NET Framework column says v4.0. 然后转到应用程序池,找到该名称并确保.NET Framework列说v4.0。

I had the same error on a w2008 x64 with the app pool running .net 4.0; 我在运行.net 4.0的应用程序池的w2008 x64上遇到了同样的错误; after installing SP2 the issue disappeared 安装SP2后,问题消失了

This issue can be seen on Windows Server 2008 without service pack 2 installed. 在未安装Service Pack 2的Windows Server 2008上可以看到此问题。 To fix the problem install Windows Server 2008 Service Pack 2. 要解决此问题,请安装Windows Server 2008 Service Pack 2。

Taken from Ram Poornalingam's WebLog entry from the 26th October 2009 : 摘自2009年10月26日Ram Poornalingam的WebLog条目

If you encounter the following error in your web application (things hosted in IIS) “The configuration section cannot be read because it is missing a section declaration" 如果在Web应用程序中遇到以下错误(IIS中托管的内容)“无法读取配置部分,因为它缺少部分声明”

examples 例子

“The configuration section 'standardEndpoints' cannot be read because it is missing a section declaration” “无法读取配置节'standardEndpoints',因为它缺少节声明”

“The configuration section 'tracking' cannot be read because it is missing a section declaration” “无法读取配置部分'tracking',因为它缺少部分声明”

then you need to install either SP2 of Vista/Win2k8 or the hotfix mentioned in KB article 958854. 然后你需要安装Vista的Vista / Win2k8或KB文章958854中提到的修补程序。

Sorry to ask a question that may seem obvious to some, but it might help others (mainly me) if you could clarify the last step: 很抱歉提出一些对某些人来说可能显而易见的问题,但如果您能澄清最后一步,它可能对其他人(主要是我)有所帮助:

Then go to Application Pools... 然后转到应用程序池...

Where do I find Application Pools ? 我在哪里可以找到应用程序池?

If you can't tell I am used to working for big companies where someone else did that for me and now I am playing developer and IT director. 如果你不能说我已经习惯了为其他人为我做的大公司工作,现在我正在扮演开发人员和IT主管。

Thanks 谢谢

Ok, after 10 seconds of research (I opened my eyes) and looked right above Sites in IIS Manager 好吧,经过10秒的研究(我睁开眼睛),然后在IIS管理器中查看站点上方

在此输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM