wcf - 获取 "Could not find a base address that matches scheme http for the endpoint with binding WSHttpBinding. Registered base address schemes are []"

标签 wcf wshttpbinding

我浏览过 Stack Overflow 并关注了 an online tutorial用于 SSL 和 WebHttpBinding。

我得到了与那里提到的相同的错误。我已恢复到旧的网络配置,如下所示。我的 https 站点工作正常,我将 WCF 添加为站点的一部分,以避免必须打开新端口。

当我收到错误时,我现在正在尝试实现类似的目标:

https://localhost/_vti_bin/TestingSQL/sample.svc/mex

<?xml version="1.0"?>
<configuration>
  <system.serviceModel>
<services>
  <service name="SharePointBits.Samples.WCFService.SampleService" behaviorConfiguration="SharePointBits.Samples.WCFService.SampleServiceBehavior">
<host> 
<baseAddresses> 
            <add baseAddress="https://testsite/_vti_bin/TestingSQL/Sample.svc"/> 
        </baseAddresses> 
    </host>

    <endpoint address="https://localhost/_vti_bin/TestingSQL/Sample.svc" binding="wsHttpBinding" contract="SharePointBits.Samples.WCFService.ISampleService" 
bindingConfiguration="wsHttpBindingEndpointBinding">
          <identity>
            <dns value="localhost"/>
      </identity>
  </endpoint>
  <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/>
  </service>
</services>
<bindings>
  <wsHttpBinding>
    <binding name="wsHttpBinding">
      <security mode="Transport">
        <transport clientCredentialType="None"/>
      </security>
    </binding>
  </wsHttpBinding>
</bindings>
<behaviors>
  <serviceBehaviors>
    <behavior name="SharePointBits.Samples.WCFService.SampleServiceBehavior">
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
      <serviceMetadata 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="">-->
      <!--<serviceMetadata httpGetEnabled="true" />-->
    <!--</behavior>-->
  </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
</configuration>'

添加网址后出现新错误:

Could not find a base address that matches scheme https for the endpoint with binding MetadataExchangeHttpsBinding. Registered base address schemes are [].

我尝试了两种方法,但都有错误。

元数据绑定(bind)添加绝对地址会导致此错误:

The HttpsGetEnabled property of ServiceMetadataBehavior is set to true and the HttpsGetUrl property is a relative address, but there is no https base address. Either supply an https base address or set HttpsGetUrl to an absolute address.

使用基地址我收到此错误:

Could not find a base address that matches scheme https for the endpoint with binding MetadataExchangeHttpsBinding. Registered base address schemes are [].

注意:我已使用基地址更改了上面的代码。

最佳答案

您有一个 MEX 端点,其地址使 WCF 认为它是相对的,但您尚未提供基地址。例如,将 MEX 端点更改为:

<endpoint address="https://testsite/_vti_bin/TestingSQL/mex" 
          binding="mexHttpsBinding" 
          contract="IMetadataExchange"/>

要么这样,要么指定 BaseAddress并在您的端点上使用它。

此外,您可能需要调整 serviceMetaData元素,特别是 httpsGetUrl。

关于wcf - 获取 "Could not find a base address that matches scheme http for the endpoint with binding WSHttpBinding. Registered base address schemes are []",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12553275/

相关文章:

c# - ASP.NET/WCF : Why are logical/physical threads dropping on full GC cycle?

通过 SSL 进行 SOAP 纯文本密码身份验证的 WCF 配置

c# - 使用 NetTcpBinding 在 WCF 中找出所需的 MaxReceivedMessageSize

wcf - 为什么我的客户发送请求如此缓慢?

jquery - 如何在 JQuery 端实现 WS-Security?

c# - Onedrive wcf 网络服务

wcf - wsHttpBinding 和 ws2007HttpBinding 有什么区别?

WCF:使用 WsHttpBinding 是否可以互操作?

php - 如何使用 wsHTTPBinding 创建 php soap wsdl 客户端?

wcf - 在 WCF 客户端的代码中设置消息版本