2011-03-10 69 views
2

我有一个WCF服务,它在http绑定上正常运行。我试图更新这个使用SSL,但我得到以下错误:更改WCF服务以要求SSL

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

这只发生在我将站点设置为“需要SSL”在IIS 7.5中,如果我取消选中它,它工作正常。

这里是我的配置

<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" /> 

我已经试过而各种但是没有一样让我在那里,任何帮助是非常感谢!

回答

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托管时不使用它。

+0

我遵循你的建议和服务现在在https上工作!非常感谢您的帮助! – WillMcKill

1

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

+0

嗨,感谢您的回复。我确实将基地址设置为https''仍然收到相同的错误。 – WillMcKill

+0

匿名后,您可以发布完整的绑定吗? – Aliostad