Https with BasicHTTPBinding - Note to Self

So if you are looking to implement SSL using basicHttpBinding for your WCF service, look no further. Here is your config file settings

The modified basicHttpBindinging to allow security mode = Transport

<bindings>
            <basicHttpBinding>
                <binding name="defaultBasicHttpBinding">
                    <security mode="Transport">
                        <transport clientCredentialType="None"/>
                    </security>
                </binding>
            </basicHttpBinding>
        </bindings>

which corresponds to your end point.

<system.serviceModel>       
        <services>
            <service behaviorConfiguration="MyServiceBehavior"
            name="MyServiceName">       
                <endpoint address="https://AdnanMasood.com/MyService.svc"
                            binding="basicHttpBinding"

                            bindingConfiguration="defaultBasicHttpBinding"

                            contract="Axis.IServiceContract" />    

and the httpsGetEnabled

<behaviors>
            <serviceBehaviors>               
                <behavior name="MyServiceBehavior">
                    <serviceMetadata httpsGetEnabled="true"/>
                    <serviceDebug includeExceptionDetailInFaults="false"/>
                </behavior>
            </serviceBehaviors>
        </behaviors>

and last but not least, if hosting in IIS, here is the key for custom factory. Details about how to do this part can be found on the MSDN article "Deploying an Internet Information Services-Hosted WCF Service" referenced below.

    <appSettings>       
        <add key="CustomIISServiceHostEndPoint" value=https://AdnanMasood.com/MyService.svc"/>
    </appSettings>

and you should be all set. Got any questions, email me.

Helpful Links

Inside the Standard Bindings: BasicHttp
http://blogs.msdn.com/drnick/archive/2006/06/01/612672.aspx

WCF-basicHttp receive location
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2154774&SiteID=1

<basicHttpBinding>
http://msdn.microsoft.com/en-us/library/ms731361.aspx

WCF Endpoints
http://www.vistax64.com/indigo/86653-wcf-endpoints.html

Securing your Web Service
http://www.theserverside.net/tt/articles/showarticle.tss?id=SecuringWCFService

Deploying an Internet Information Services-Hosted WCF Service
http://msdn.microsoft.com/en-us/library/aa751792.aspx

Custom Service Host
http://msdn.microsoft.com/en-us/library/aa395224.aspx

Share

4 thoughts on “Https with BasicHTTPBinding - Note to Self

  1. Because my service requires streaming to be enabled, I have to use basicHttpBinding and Transport level security (right?); further to that, the method contained in my service can only accept a Stream object. Taking those constraints into consideration along with my preference to use username/password validation... How should I modify my service's config file to force username/password credentials to be supplied?
    How will my service validate the supplied credentials?
    How will my client application pass credentials the service when making a call?
    Will this require using SSL and, if so, will all client machines require a certificate as well?

  2. 'd like to avoid adding certificates to client machines since the users of the application change often. I'd like to implement the username/password method you mentioned but I'm not sure how I would transmit those values to the actual service. The method being exposed by the service has streaming enabled so I wouldn't be able to pass those values as parameters (due to the method signature restrictions in place for a streaming-enabled service); can you recommend a method for passing a un/pw combo to the service and authenticating from within the service?

Comments are closed.