About The Author
Michael Flynn is a Web Developer at Terralever, an interactive marketing agency based in Tempe, AZ. He specializes in web technologies that include C# .NET, SQL, XML, AJAX, jQuery, Flash, and also skills in Photoshop and Illustrator. He was been involved in web development since 1998, and earned a Bachelors and Masters degree in Computer Engineering and Computer Science from the Univerisity of Louisville and holds an MSCT certificate in Web Applications.
Calendar
<<  September 2010  >>
SMTWTFS
2930311234
567891011
12131415161718
19202122232425
262728293012
3456789

Use a WCF Service with HTTP and HTTPS in C#

I had a problem with a WCF service that was having problems on a secure page using SSL.  The error said the endpoint could not be found.  I found some resources on making a service HTTPS ready, but not for both.  I finally figured it out that I need two endpoints pointing to the same service.  One endpoing contained another property called "bindingConfiguration" that maps a binding that has a mode of transport which enables an endpoint for https.  The bolded text below is what you need to enable a service for HTTPS.

   

<system.serviceModel>

    <serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>

    <behaviors>

        <endpointBehaviors>

            <behavior name="WebServicesBehavior">

                <webHttp/>

            </behavior>

        </endpointBehaviors>

    </behaviors>

    <services>

        <service name="WebService">

            <endpoint binding="webHttpBinding" contract="IWebService" behaviorConfiguration="WebServicesBehavior"/>

            <endpoint binding="webHttpBinding" bindingConfiguration="webBinding" contract="IWebService" behaviorConfiguration="WebServicesBehavior"/>

        </service>

    </services>

    <bindings>

        <webHttpBinding>

            <binding name="webBinding">

                <security mode="Transport">

                    <transport clientCredentialType="None"/>

                </security>

            </binding>

        </webHttpBinding>

    </bindings>

</system.serviceModel>

Posted on 10/18/2008 12:54:00 AM by cblaze22

Permalink | Comments (3) | Post RSSRSS comment feed |

Categories: ASP.NET | Development Tips | Tips | WCF

Tags: ,

Currently rated 5.0 by 2 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5