代码之家  ›  专栏  ›  技术社区  ›  mpeterson

无法获取WCF数据服务示例以运行

  •  1
  • mpeterson  · 技术社区  · 10 年前

    运行Windows 7 Enterprise。已安装VS2013。

    我无法运行任何WCF数据服务应用程序。(例如。 http://code.msdn.microsoft.com/WCF-Data-50-for-OData-v3-53074189 )

    我收到以下异常:

    Configuration endpoint extension 'standardEndpoints/webHttpEndpoint' could not be found. Verify that this endpoint extension is properly registered in system.serviceModel/extensions/endpointExtensions and that it is spelled correctly.
    

    我有一位同事尝试过,他们能够立即运行样本,无一例外。

    我觉得这意味着缺少某种WCF组件,但谷歌对此毫无帮助。

    有人能帮忙吗?

    2 回复  |  直到 10 年前
        1
  •  1
  •   jordanhill123 Rang    10 年前

    从…起 MSDN - Deploying an Internet Information Services-Hosted WCF Service

    确保正确安装了IIS、ASP.NET和WCF 已注册


    必须为IIS托管的WCF服务安装WCF、IIS和ASP.NET 功能正常。安装WCF的过程(作为 WinFX)、ASP.NET和IIS因操作系统版本而异 正在使用。有关安装WCF和WinFX的更多信息, 请参阅Microsoft.NET Framework 4 Web安装程序。说明 安装IIS可以在安装IIS中找到。

    WinFX的安装过程自动注册WCF 如果计算机上已存在IIS,则使用IIS。如果安装了IIS 在WinFX之后,需要额外的步骤来注册WCF IIS和ASP.NET。根据您的 操作系统:

    Windows XP SP2、Windows 7和Windows Server 2003:使用ServiceModel注册工具(ServiceModelReg.exe) 向IIS注册WCF的工具:若要使用此工具,请键入 Visual Studio命令提示符中的ServiceModelReg.exe/i/x。你可以 单击“开始”按钮,选择“全部”,打开此命令提示 程序、Microsoft Visual Studio 2012、Visual Studio Tools和 Visual Studio命令提示符

    Windows Vista:安装Windows Communication Foundation WinFX的激活组件子组件。为此,在 “控制面板”,单击“添加或删除程序”,然后单击“添加/删除” Windows组件。这将激活Windows组件向导。

    Windows 7:

    最后,您必须验证ASP.NET是否配置为使用.NET 框架版本4。您可以通过运行ASPNET_Regiis工具来执行此操作 使用i选项。有关详细信息,请参阅ASP.NET IIS注册 工具

    我以前在配置WCF服务以在新建立的服务器和我从零开始建立的开发/登台环境中运行时遇到过这个问题。此链接上的信息已多次对此提供帮助。

        2
  •  0
  •   mpeterson    10 年前

    我想通了。。问题是我在machine.config中缺少了webHttpEndPoint的扩展定义。

    例如

      <system.serviceModel>
        <extensions>            
            <endpointExtensions>                
                <add name="webHttpEndpoint" type="System.ServiceModel.Configuration.WebHttpEndpointCollectionElement, System.ServiceModel.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />                
            </endpointExtensions> 
        </extensions>
      <system.serviceModel>