代码之家  ›  专栏  ›  技术社区  ›  mark vanzuela

RESTful WCF 4.0上的IIS 7.5错误

  •  15
  • mark vanzuela  · 技术社区  · 14 年前

    我一直在尝试做一个简单的RESTfulWCF服务,它将返回JSON。如果我在开发服务器中运行它,它就会工作。但是,如果我将它部署到IIS 7.5上,当我使用 http://localhost:70

    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>
    

    我是WCF的新手,特别是在.NET 4.0和IIS 7.5上。

    有人能帮忙吗?或者有人经历过同样的事情,并且已经修复了?

    4 回复  |  直到 11 年前
        1
  •  24
  •   Jeff    14 年前

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

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

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

        2
  •  2
  •   dc2009    13 年前

    我在运行.NET 4.0的应用程序池的W2008 x64上出现了相同的错误;安装SP2之后,问题消失了。

        3
  •  1
  •   MikeD    11 年前

    在未安装Service Pack 2的Windows Server 2008上可以看到此问题。若要解决此问题,请安装Windows Server 2008 Service Pack 2。

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

    如果在Web应用程序中遇到以下错误(以IIS为宿主的内容)无法读取配置节,因为它缺少节声明”

    实例

    _156;无法读取配置节“StandardEndpoints”,因为它缺少节声明__

    _无法读取配置节__tracking_,因为它缺少节声明__

    然后您需要安装Vista/Win2K8的SP2或知识库文章958854中提到的修补程序。

        4
  •  -1
  •   user1054326    12 年前

    很抱歉问一个对某些人来说似乎很明显的问题,但如果你能澄清最后一步,它可能会帮助其他人(主要是我):

    然后转到应用程序池…

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

    如果你不能告诉我,我已经习惯于在大公司工作了,其他人也为我这样做了,而现在我正在扮演开发人员和IT总监的角色。

    谢谢

    好的,经过10秒钟的研究(我睁开眼睛),在IIS管理器中查看了上面的站点

    ERS(主要是我)如果你能澄清最后一步:

    然后转到应用程序池…

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

    如果你不能告诉我,我已经习惯于在大公司工作了,其他人也为我做了这些,现在我在扮演开发人员和IT主管。

    谢谢

    好的,经过10秒钟的研究(我睁开眼睛),在IIS管理器中查看了上面的站点

    enter image description here