Congratulations to all monthly winners of May 2013 !!! They have won INR 2900 cash and INR 27497 worth prize.
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 7442 |  Welcome, Guest!   Register  Login
 Home > Forums > WCF > Publish WCF Service in IIS with support for both HTTP and HTTPS ...
Krishnasamy2008

Publish WCF Service in IIS with support for both HTTP and HTTPS

Replies: 1 | Posted by: Krishnasamy2008 on 5/11/2012 | Category: WCF Forums | Views: 1727 | Status: [Member] | Points: 10  


Hi Friends,

I have a WCF-Service configured with two endpoints using wsHttpBinding, one for http and the other for https. They use the same address, the endpoints just differ by the used protocol:

<services>
<service name="Test.ClientService">
<endpoint binding="wsHttpBinding" bindingConfiguration="wsBindingConfig" behaviorConfiguration="wsBehaviour" contract="Test.Contracts.IClientService"/>
<endpoint binding="wsHttpBinding" bindingConfiguration="sslWsBindingConfig" behaviorConfiguration="wsBehaviour" contract="Test.Contracts.IClientService"/> </service>
<services>

using the following behaviours and bindings:

<behaviors>
<endpointBehaviors>
<behavior name="wsBehaviour">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<webHttpBinding>
<binding name="wsBindingConfig">
<security mode="None"/>
</binding>
<binding name="sslWsBindingConfig">
<security mode="Transport"/>
</binding>
</webHttpBinding>
</bindings>

Both endpoints works fine when I have the certificate installed on IIS 6.

When the certificate is not installed in the IIS, the HTTPS-Endpoint certainly won't work. But the HTTP-Endpoint also doesn't work.
It fails with an exception: when I access the service with http://localhost:5034/Test/ClientService.svc
The exception is as below:
Could not find a base address that matches scheme https for the endpoint with binding WebHttpBinding. Registered base address schemes are [http].
which is irritating because I didn't request an HTTPS-URL.
Now when I split the service into two, the HTTP-Access also works on the IIS on which the SSL-Certificate is not installed:

<services>
<service name="Test.ClientServicee"> <endpoint binding="wsHttpBinding" bindingConfiguration="wsBindingConfig" behaviorConfiguration="webBehaviour" contract="Test.Contracts.IClientService"/>
</service>
<service name="Test.ClientService">
<endpoint binding="wsHttpBinding" bindingConfiguration="sslWsBindingConfig" behaviorConfiguration="webBehaviour" contract="Test.Contracts.IClientService"/>
</service>
</services>

The problem now is that the client has to use two different endpoints instead of just changing the protocol. We have a system where the customer can turn on SSL via our Configuration-Tool depending on their security needs. But I don't want to force them to change the web.config of the WCF-Service.I want to access both endpoints protocol http or https simultaneously.Please can anyone guide me how to do.

Thanks ,
Krishna.K


Reply | Reply with attachment | Alert Moderator

 Responses below this adGet hundreds of .NET Tips and Tricks videos

 Replies

Rajkatie
Rajkatie  
Posted on: 6/23/2012 6:45:38 AM
Level: Silver | Status: [Member] | Points: 25

Hi Krishnasamy,

Your requirement may be fullfilled by WCF 4.5 because it support Multiple Authentication. Please refer following link
http://msdn.microsoft.com/en-us/library/dd456789%28v=vs.110%29.aspx

Rajesh Patel
MCPD,MS
Brainbench (Asp.Net 4.0 and CSS 3.0)

Krishnasamy2008, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Reply - Please login to reply


Click here to login & reply

Found interesting? Add this to:


 Latest Posts

Write New Post | More ...

About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 6/18/2013 7:59:56 PM