9

我已经通过 Stack Overflow 并遵循了 SSL 和 WebHttpBinding的在线教程

我得到了与那里提到的相同的错误。我已恢复到旧的 Web 配置,如下所示。我的 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>'

添加我的网址后,出现一个新错误:

找不到与绑定 MetadataExchangeHttpsBinding 的终结点的方案 https 匹配的基地址。注册的基地址方案是 []。

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

添加一个绝对地址给metadatabinding我这个错误:

ServiceMetadataBehavior 的 HttpsGetEnabled 属性设置为 true,HttpsGetUrl 属性是相对地址,但没有 https 基地址。提供 https 基地址或将 HttpsGetUrl 设置为绝对地址。

使用基地址我得到这个错误:

找不到与绑定 MetadataExchangeHttpsBinding 的终结点的方案 https 匹配的基地址。注册的基地址方案是 []。

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

4

1 回答 1

9

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

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

Either that, or specify a BaseAddress and use that on your endpoints.

In addition, you may want to tweak the serviceMetaData element, specifically the httpsGetUrl.

于 2012-09-23T15:45:23.873 回答