Thursday 15 April 2010

c# - How to configure a WCF service with basicHttpBinding and windows authentication and binary encoding -



c# - How to configure a WCF service with basicHttpBinding and windows authentication and binary encoding -

there lots of existing questions/answers subsets of question (basichttpbinding windows authentication, using custom bindings, specifying binarymessageencoding). however, there no existing answers particular combination of 3 of items.

i started simple wcf service using basichttpbinding, windows authentication, bindings section looked like:

<bindings> <basichttpbinding> <binding name="basichttpwindowsbinding"> <security mode="transportcredentialonly"> <transport clientcredentialtype="windows" /> </security> </binding> </basichttpbinding> </bindings>

i tested wcf service , works fine respect windows authentication. then, wanted utilize binary message encoding boost performance. so, that's when veered custom binding territory because appears 1 can specify binary message encoding basichttpbinding in custom binding section, such example:

<bindings> <custombinding> <binding name="basichttpwindowsbinding"> <binarymessageencoding /> <httptransport /> </binding> </custombinding> </bindings>

(and need exact combination of things; please don't advise me switch wshttpbinding, or utilize nettcpbinding, etc.)

but have problem (unless i'm missing something) because can specify windows authentication under basichttpbinding section, , can specify binarymessageencoding http protocol under custombinding section.

so question is, how 1 specify basichttpbinding protocol, windows authentication, , using binarymessageencoding, if possible? (i have honest , admit finding configuration of wcf services hard grok, @ to the lowest degree when custom bindings thrown mix...)

i think right custom binding specifications be:

<bindings> <custombinding> <binding name="basichttpwindowsbinding"> <binarymessageencoding /> <httptransport authenticationscheme="windows" /> </binding> </custombinding> </bindings>

... equivalent

<bindings> <basichttpbinding> <binding name="basichttpwindowsbinding"> <security mode="transportcredentialonly"> <transport clientcredentialtype="windows" /> </security> </binding> </basichttpbinding> </bindings>

... respect specifying windows authentication (kerberos, not ntlm) wcf service?

windows authentication:

<bindings> <basichttpbinding> <binding name="basichttpendpointbinding"> <security mode="transportcredentialonly"> <transport clientcredentialtype="windows" /> </security> </binding> </basichttpbinding> </bindings>

httpbinding:

<services> <service behaviorconfiguration="servicebehavior" name="service"> <endpoint address="" binding="basichttpbinding" bindingconfiguration="basichttpendpointbinding" name="basichttpendpoint" contract="iservice"> <identity> <dns value="localhost" /> </identity> </endpoint> <endpoint address="mex" binding="mexhttpbinding" contract="imetadataexchange" /> </service> </services>

c# asp.net .net wcf authentication

No comments:

Post a Comment