0

we have developed a WCF webservice and it has been working fine without any requirement of SSL being introduced. Now, before deploying it to Test envirnment we need to make it SSL enabled.

So I came across this link on SO : Enable SSL for my WCF service

and changed my config file to include following code:

 <binding name="BasicHttpBinding_IPromotionalSponsorship" allowCookies="true"
            maxReceivedMessageSize="20000000"
            maxBufferSize="20000000"
            maxBufferPoolSize="20000000">
      <readerQuotas maxDepth="32"
           maxArrayLength="200000000"
           maxStringContentLength="200000000"/>
         <security mode="Transport">              
         </security>
       </binding>

While my endpoint looks like following

 <endpoint address="" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IPromotionalSponsorship"
          name="StandardEndpoint" contract="PL.Commercial.PromoSponsor.Service.Contracts.IPromotionalSponsorship" />

But it does not sound like it changed anything still when I run my project, it shows the URL without https.

Now, when i explicitly add 's' in the URl it throws following error:

Unable to make a secure connection to the server. This may be a problem with the server, or it may be requiring a client authentication certificate that you don't have.

I have created a self-signed certificate and added it to my local IIS. Anything special that I need to change/add?

Community
  • 1
  • 1
Lost
  • 12,007
  • 32
  • 121
  • 193

1 Answers1

1

You need to do following changes.

  1. If you don't need client authentication and just HTTPS then your binding configuration should look like below. Note transport element.

     <binding name="BasicHttpBinding_IPromotionalSponsorship" allowCookies="true"
             maxReceivedMessageSize="20000000"
             maxBufferSize="20000000"
             maxBufferPoolSize="20000000">
      <readerQuotas maxDepth="32"
           maxArrayLength="200000000"
           maxStringContentLength="200000000"/>
      <security mode="Transport">
        <transport clientCredentialType="None"/>
      </security>
    </binding>
    
  2. If you want browser to display https when you browse service. Your service behaviour should look like below.

    <behaviors>
    <serviceBehaviors>
       <behavior>
         <serviceMetadata httpsGetEnabled="True" httpsGetBinding="mexHttpsBinding"/>
       </behavior>
    </serviceBehaviors>
    </behaviors>
    
  3. If you are getting error "Unable to make a secure connection to the server..." as mentioned in question that means you have configured service in such way that it requires client certificate. I guess you just need to enable HTTPS. In that case you don't need to configure client certificate requirement in IIS. Your application's SSL settings should look like this. enter image description here

Pankaj Kapare
  • 7,486
  • 5
  • 40
  • 56
  • If you do need client cert authentication then read this document. http://dotnetdevblog.blogspot.com/2010/08/setting-up-client-certificate.html – loneshark99 Mar 03 '16 at 01:26
  • I added the self-sgned cert following instructions here: http://weblogs.asp.net/scottgu/tip-trick-enabling-ssl-on-iis7-using-self-signed-certificates without any luck on this – Lost Mar 03 '16 at 01:45
  • @pankaj: Thank for your comments. I still did not #3 of your answer. Can you please elaborate? – Lost Mar 03 '16 at 18:53
  • OK, I think this is in IIS. However, I am not mapping my service to iis. I am using regular Visual Studio IIS Express. Does this setting apply there? – Lost Mar 03 '16 at 20:21