Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configuring a WCF service (Web.config) - HttpsGetEnabled, HttpsGetUrl

I am trying to deploy a Silverlight with WCF Service to a hosting. Basically, I have the same problem as this guy: How to configure WCF services to work through HTTPS without HTTP binding? Except the solutions don't work for me.

//edit: I've been pasting it wrong, but it still doesn't work.

I have tried Ladislav Mrnka's answer - changed this in the Web.config file:

  <serviceMetadata httpGetEnabled="false" httpsGetEnabled="true" />

The dreaded error still appears when I navigate to the .svc file on the server:

The HttpsGetEnabled property of ServiceMetadataBehavior is set to true and the
HttpsGetUrl property is a relative address, but there is no https base address.
Either supply an https base address or set HttpsGetUrl to an absolute address.
like image 271
lukfi Avatar asked Jun 20 '12 20:06

lukfi


2 Answers

Now it should be all correct, I just changed the httpGetEnabled and httpsGetEnabled in the proper place (it's already in the config file). But I still get the error. Should I perhaps specify the HttpsGetUrl somewhere? Where?

Yes, see here.

Should be:

<behaviors>
 <serviceBehaviors>
  <behavior name="NewBehavior">
    <serviceMetadata httpsGetEnabled="true" 
     httpsGetUrl="https://myComputerName/myEndpoint" />
  </behavior>
 </serviceBehaviors>
</behaviors>
like image 173
Marcel N. Avatar answered Oct 01 '22 01:10

Marcel N.


This error happened because the setting is logically wrong. If you enable the httpsGetEnabled means, you allow clients to retrieve metadata via https. And if you don't provide a URL about https, how can clients retrieve metadata from https. So the error message alert you to provide a URL.

Either supply an https base address or set HttpsGetUrl to an absolute address.

You have three options.

  1. Provide httpsGetUrl as other answers showed above
  2. Binding an address via IIS

Bindings Site Bindings

(if you are still developing in visual studio then you only need to degug with SSL Enabled mode ) SSL Enabled

  1. Set httpsGetEnabled to false

like image 27
Sungfu Chiu Avatar answered Oct 01 '22 02:10

Sungfu Chiu