【问题标题】:IIS 7.5 Error on Restful WCF 4.0Restful WCF 4.0 上的 IIS 7.5 错误
【发布时间】:2011-04-11 22:27:01
【问题描述】:

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

访问它时会出现此错误

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

配置错误配置部分 无法读取“标准端点” 因为它缺少一个部分 声明

这是我的配置文件:这是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 上。

有人可以帮忙吗?或者任何人都经历过同样的事情并且已经解决了?

【问题讨论】:

    标签: wcf web-config c#-4.0


    【解决方案1】:

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

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

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

    【讨论】:

    • 感谢这个人,我检查并发现我的应用程序创建了自己的应用程序池,它使用 asp.net 2.0 而不是 4.0。现在它的工作。非常感谢。
    【解决方案2】:

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

    【讨论】:

      【解决方案3】:

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

      然后转到应用程序池...

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

      如果你不知道我已经习惯了为大公司工作而其他人为我工作,而现在我正在扮演开发人员和 IT 总监的角色。

      谢谢

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

      【讨论】:

        【解决方案4】:

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

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

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

        例子

        “无法读取配置节 'standardEndpoints',因为它缺少节声明”

        “无法读取配置节‘跟踪’,因为它缺少节声明”

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

        【讨论】:

        • 这正是我们在将一些旧的 x86 应用服务器从 IIS 6 (2003) 升级到 IIS 7 (2008 SP2) 后遇到的问题。感谢分享修复!
        猜你喜欢
        • 2011-08-14
        • 1970-01-01
        • 1970-01-01
        • 2013-10-29
        • 1970-01-01
        • 2018-05-06
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多