2

我有一个在 http 绑定上运行良好的 WCF 服务。我尝试将其更新为使用 SSL,但出现以下错误:

“找不到与绑定 WSHttpBinding 的端点的方案 http 匹配的基地址。注册的基地址方案是 [https]。”

仅当我在 IIS 7.5 中将站点设置为“需要 SSL”时才会发生这种情况,如果我取消选中它可以正常工作。

这是我的配置

<system.serviceModel>    
<behaviors>
  <serviceBehaviors>
    <behavior name="ServiceBehavior" >
      <dataContractSerializer maxItemsInObjectGraph="2147483646"/>
      <!-- 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="false" />
      <serviceMetadata httpGetEnabled="false" httpsGetEnabled="true" />
    </behavior>
  </serviceBehaviors>
</behaviors>
<bindings>
  <wsHttpBinding>
    <binding name="wsHttpEndpointBinding">
    </binding>
  </wsHttpBinding>
</bindings>
<services>
  <service behaviorConfiguration="ServiceBehavior" name="WcfService1.Service1">
    <host>
      <baseAddresses>
        <add baseAddress="http://localhost/WcfService1/"/>
      </baseAddresses>
    </host>
    <endpoint address="" binding="wsHttpBinding" bindingConfiguration=""
      name="wsHttpEndpoint" contract="WcfService1.IService1" />
    <endpoint address="mex" binding="mexHttpsBinding" bindingConfiguration=""
      name="MexHttpsBindingEndpoint" contract="IMetadataExchange" />
  </service>
</services>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />

我已经尝试了各种方法,但似乎没有什么能让我到达那里,非常感谢任何帮助!

4

2 回答 2

1

修改绑定配置:

<bindings>
  <wsHttpBinding>
    <binding name="wsHttpEndpointBinding">
      <security mode="Transport" />
    </binding>
  </wsHttpBinding>
</bindings>

endpoint并通过将其bindingConfiguration属性设置为配置名称来引用您的配置。

<endpoint address="" binding="wsHttpBinding" 
  bindingConfiguration="wsHttpEndpointBinding"
  name="wsHttpEndpoint" contract="WcfService1.IService1" />

您也可以删除host带有基地址的部分,因为在 IIS 中托管时不使用它。

于 2011-03-10T10:32:23.917 回答
1

除了更改绑定配置设置(如 Ladislav 所述)...将基地址中的 HTTP 更改为 HTTPS。

于 2011-03-10T10:32:57.860 回答