Reputation: 11
How to convert this wcf basic binding to a custom binding ??
<basicHttpBinding>
<binding name="BasicHttpBinding_IAutenticacion" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="TransportWithMessageCredential">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Certificate" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
Thanks advance!
Upvotes: 1
Views: 5626
Reputation: 24436
Check out the online wcf binding converter http://webservices20.blogspot.co.il/2009/08/bindingbox-convert-wcf-bindings.html
EDIT: when you use this service remember to hace a tag before the (as in the default sample there). Then the result will be:
<!-- generated via Yaron Naveh's http://webservices20.blogspot.com/ -->
<customBinding>
<binding name="NewBinding0">
<security authenticationMode="CertificateOverTransport" messageSecurityVersion="WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10" requireDerivedKeys="false" securityHeaderLayout="Lax" />
<textMessageEncoding MessageVersion="Soap11" />
<httpsTransport />
</binding>
</customBinding>
<!-- generated via Yaron Naveh's http://webservices20.blogspot.com/ -->
EDIT: this is how you create this binding from code:
var b = new CustomBinding();
var s = SecurityBindingElement.CreateCertificateOverTransportBindingElement(
MessageSecurityVersion.WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10);
s.SetKeyDerivation(false);
s.SecurityHeaderLayout = SecurityHeaderLayout.Lax;
b.Elements.Add(s);
b.Elements.Add(new TextMessageEncodingBindingElement() { MessageVersion = MessageVersion.Soap11});
b.Elements.Add(new HttpsTransportBindingElement());
when you create your client you can set certificates like this:
c.ClientCredentials.ClientCertificate.Certificate
Upvotes: 2