我有一个WCF服务,它在http绑定上运行正常。我试图更新它以使用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" />
我已经尝试了各种各样,似乎没有任何东西让我在那里,非常感谢任何帮助!
答案 0 :(得分: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中托管时不会使用该部分。
答案 1 :(得分:1)
除了更改绑定配置设置外(如Ladislav所述)...将基地址中的HTTP更改为HTTPS。