【问题标题】:Configuration Binding extension could not be found, Binding exists but service can't see it找不到配置绑定扩展,绑定存在但服务看不到它
【发布时间】:2014-09-12 08:46:58
【问题描述】:

我已尝试使用所有我能找到但无法正常工作的解决方案。我正在尝试将我的本地计算机连接到连接为 https 的服务器。我得到的最新错误是:-

找不到配置绑定扩展“system.serviceModel/bindings/WSHttpBinding_IService”。验证此绑定扩展是否已在 system.serviceModel/extensions/bindingExtensions 中正确注册并且拼写正确。

当我查看我的 web.config 时,我可以在绑定部分看到 WSHttpBinding_IService。我想知道我做错了什么。我的 web.config 是:-

<?xml version="1.0"?>
<configuration>
  <appSettings>
    <add key="baseaddress" value="https://Silvertest.Example.com/Silver"/>
  </appSettings>
  <connectionStrings>
    <add name="" connectionString=""/>
  </connectionStrings>
  <system.web>

<customErrors mode="Off"/>
<compilation debug="true" targetFramework="4.5">
  <assemblies>
    <add assembly="System.DirectoryServices.AccountManagement, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
    <add assembly="System.DirectoryServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
  </assemblies>
</compilation>
<pages controlRenderingCompatibilityVersion="4.0"/>
<httpRuntime targetFramework ="4.5"  />
</system.web>
<system.serviceModel>
<services>
  <service name="Silver" >
    <endpoint address=""  binding="WSHttpBinding_IService" contract="IService"  />
    <host>
      <baseAddresses>
        <add baseAddress="https://Silvertest.Example.com/Silver/service.svc"/>
      </baseAddresses>
    </host>
  </service >
</services>
<client>
  <endpoint address="https://Silvertest.Example.com/Silver/Service.svc"
    binding="WSHttpBinding" bindingConfiguration="wsHttpBinding"
    contract="IService" name="SecureWCF" />
</client>
<protocolMapping>
  <add scheme="https" binding="WSHttpBinding_IService" bindingConfiguration="SecureWCF" />
</protocolMapping>
<extensions>
  <endpointExtensions>

  </endpointExtensions>
</extensions>
<bindings>
  <wsHttpBinding>
    <binding name="WSHttpBinding_IService" closeTimeout="00:01:00"
      openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
      bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
      maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text"
      textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
      <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
      <reliableSession ordered="true" inactivityTimeout="00:10:00"
        enabled="false" />
      <security mode="Transport">
        <transport clientCredentialType ="None"/>
      </security>
    </binding>

  </wsHttpBinding>
  <basicHttpBinding>
    <binding closeTimeout="10:01:00" openTimeout="10:01:00" receiveTimeout="00:10:00"
      sendTimeout="10:01:00" allowCookies="false" bypassProxyOnLocal="false"
      hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288"
      maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"
      textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"
      messageEncoding="Text">
      <readerQuotas maxDepth="32" maxStringContentLength="2147483647"
        maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
      <security mode="Transport">
        <transport clientCredentialType="None" />
        <message/>
      </security>
    </binding>
    <binding name="BasicHttpBinding_IRemote" />
  </basicHttpBinding>
</bindings>
<behaviors>
  <serviceBehaviors>
    <behavior>
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
      <serviceMetadata httpGetEnabled="true" httpsGetEnabled  ="true"/>
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug includeExceptionDetailInFaults="true"/>
    </behavior>
    <behavior name="SecureWCF">
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
      <serviceMetadata httpGetEnabled="true" httpsGetEnabled  ="true"/>
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug includeExceptionDetailInFaults="true"/>
    </behavior>
  </serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
</system.serviceModel>
<system.webServer>
  <modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>

【问题讨论】:

    标签: c# wcf


    【解决方案1】:

    您的客户端和服务器端点配置对于初学者来说是错误的。试试这个:

    <endpoint address="https://Silvertest.Example.com/Silver/Service.svc"
    binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IService"
    contract="IService" name="SecureWCF" />
    

    您必须为服务器和客户端端点元素指定bindingbindingConfiguration 属性。确保绑定配置元素也匹配(除非您使用 SSL 卸载,但我假设您没有)。

    【讨论】:

    • 我按照您的建议进行了更改,但是,我仍然遇到同样的错误。找不到配置绑定扩展“system.serviceModel/bindings/WSHttpBinding_IService”。验证此绑定扩展是否已在 system.serviceModel/extensions/bindingExtensions 中正确注册,并且拼写正确。
    • 目前,我只是想让它在浏览器中工作,然后再担心客户端。
    • 如果绑定上的大小写现在正确,则可能是配置中的排序问题。检查 serviceModel 元素使用的顺序,如 MSDN 中所示:msdn.microsoft.com/en-us/library/ms731354%28v=vs.110%29.aspx
    • 我重新组织了它,但这似乎没有任何效果,也没有改变大小写。
    • 您收到的第二条错误消息仍然表明您在 binding 属性中的值错误 - 它必须是 wsHttpBinding 才能说绑定类型是 wsHttpBindingbindingConfiguration 用于命名它应该使用的 wsHttpBinding 孩子。
    猜你喜欢
    • 2011-04-24
    • 2013-08-16
    • 2013-09-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多