54

My WebConfig:

<bindings>
  <webHttpBinding>
    <binding name="SecureBasicRest">
      <security mode="Transport" />
    </binding>
  </webHttpBinding>
</bindings>
<behaviors>
  <serviceBehaviors>
    <behavior name="svcBehavior">
      <serviceMetadata httpsGetEnabled="true"/>
      <serviceDebug includeExceptionDetailInFaults="false"/>
    </behavior>
  </serviceBehaviors>
  <endpointBehaviors>
    <behavior name="svcEndpoint">
      <webHttp helpEnabled="true"/>
      <enableWebScript/>
    </behavior>
  </endpointBehaviors>
</behaviors>
<services>
  <service name="SvcContract.Authenticate" behaviorConfiguration="svcBehavior">
    <endpoint binding="webHttpBinding" bindingConfiguration="SecureBasicRest"
              behaviorConfiguration="svcEndpoint" name="webHttp"
              contract="SvcContract.Authenticate" />
  </service>
</services>

I have to make this work with
https://localhost:6188/Authenticate/Login?username=user&password=pass&ip=127.0.0.1

starball
  • 20,030
  • 7
  • 43
  • 238
fiberOptics
  • 6,955
  • 25
  • 70
  • 105

6 Answers6

67

Change

<serviceMetadata httpsGetEnabled="true"/>

to

<serviceMetadata httpsGetEnabled="false"/>

You're telling WCF to use https for the metadata endpoint and I see that your'e exposing your service on http, and then you get the error in the title.

You also have to set <security mode="None" /> if you want to use HTTP as your URL suggests.

J M
  • 396
  • 6
  • 23
Per Kastman
  • 4,466
  • 24
  • 21
  • 2
    I'm sorry for typo error, I really have to make it using https. Your answer works great for http, but how could it work for https? Thanks – fiberOptics Mar 22 '12 at 07:09
  • Have you set up ssl bindings for your site in IIS? – Per Kastman Mar 22 '12 at 09:08
  • 2
    Just to make it clear, are you running your service in visual studio's web server? It does not support SSL. If you need to do development with SSL use IIS Express. – Per Kastman Mar 22 '12 at 09:23
30

You would need to enable https binding on server side. IISExpress in this case. Select Properties on website project in solution explorer (not double click). In the properties pane then you need to enable SSL.

Softec
  • 1,087
  • 11
  • 14
2

I solved the issue by adding https binding in my IIS websites and adding 443 SSL port and selecting a self signed certificate in binding.

enter image description here

Bimal Das
  • 1,882
  • 5
  • 28
  • 53
0

To make it work you have to replace a run this line of code serviceMetadata httpGetEnabled="true"/> http instead of https and security mode="None" />

Kiquenet
  • 14,494
  • 35
  • 148
  • 243
MrTony78
  • 35
  • 1
  • 7
0

In the endpoint tag you need to include the property address=""

<endpoint address="" binding="webHttpBinding" bindingConfiguration="SecureBasicRest" behaviorConfiguration="svcEndpoint" name="webHttp" contract="SvcContract.Authenticate" />

0

In our case; I had to remove the "<baseAddressPrefixFilters" from the config file.

Pradip
  • 1
  • 1
  • This does not really answer the question. If you have a different question, you can ask it by clicking [Ask Question](https://stackoverflow.com/questions/ask). To get notified when this question gets new answers, you can [follow this question](https://meta.stackexchange.com/q/345661). Once you have enough [reputation](https://stackoverflow.com/help/whats-reputation), you can also [add a bounty](https://stackoverflow.com/help/privileges/set-bounties) to draw more attention to this question. - [From Review](/review/late-answers/33314615) – ufosnowcat Dec 06 '22 at 09:57