How to configure WCF services to work through HTTPS without HTTP binding?

为君一笑 提交于 2019-12-18 12:14:19

问题


I have configured my WCF services to work with SSL but it works ONLY if the HTTP binding exists in the IIS Web Site. When the HTTP binding not exists and exists only HTTPS binding I get the following error:

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

How can I resolve this issue?

Thanks.


回答1:


Modify your configuration this way:

<behaviors>
  <serviceBehaviors>
    <behavior> <!-- behavior can have name (must have name in WCF 3.x) -->
      <serviceMetadata httpGetEnabled="false" httpsGetEnabled="true" />
    </behavior>
  </serviceBehaviors>
</behaviors>



回答2:


you need to use mexHTTPSBinding unstead of mexHTTPBinding

<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />


来源:https://stackoverflow.com/questions/4863590/how-to-configure-wcf-services-to-work-through-https-without-http-binding

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!