Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 552
Dmitrii Avatar asked Feb 01 '11 14:02

Dmitrii


People also ask

What are 3 basic WCF configurations required for hosting a WCF service?

There are three types of hosting environments for WCF services: IIS, WAS, and self-hosting. The term “self-hosting” refers to any application that provides its own code to initialize the hosting environment. This includes console, Windows Forms, WPF, and managed Windows services.

What is binding in WCF?

Bindings are objects that are used to specify the communication details that are required to connect to the endpoint of a Windows Communication Foundation (WCF) service. Each endpoint in a WCF service requires a binding to be well-specified.

How do I enable multipleSiteBindingsEnabled?

This feature is only available to WCF services that are hosted under IIS. This feature is not enabled by default. To enable it you must add the multipleSiteBindingsEnabled attribute to the < serviceHostingEnvironment > element in your Web. config file and set it to true , as shown in the following example.


2 Answers

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>
like image 187
Ladislav Mrnka Avatar answered Oct 29 '22 19:10

Ladislav Mrnka


you need to use mexHTTPSBinding unstead of mexHTTPBinding

<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
like image 45
DesignFirst Avatar answered Oct 29 '22 19:10

DesignFirst