WCF imperative binding -
how translate following declarative (via configuration file) binding, imperative binding (hardcoded inside application)?
<system.servicemodel> <bindings> <custombinding> <binding name="custombinding_iaeservice"> <security defaultalgorithmsuite="basic256sha256rsa15" authenticationmode="mutualcertificateduplex" requirederivedkeys="false" securityheaderlayout="lax" includetimestamp="true" allowserializedsigningtokenonreply="true" keyentropymode="combinedentropy" messageprotectionorder="signbeforeencrypt" messagesecurityversion="default" requiresignatureconfirmation="false"> <localclientsettings cachecookies="true" detectreplays="true" replaycachesize="900000" maxclockskew="00:05:00" replaywindow="00:05:00" sessionkeyrenewalinterval="10:00:00" sessionkeyrolloverinterval="00:05:00" reconnecttransportonfailure="true" timestampvalidityduration="00:05:00" cookierenewalthresholdpercentage="60" /> <localservicesettings detectreplays="true" issuedcookielifetime="10:00:00" maxstatefulnegotiations="128" replaycachesize="900000" maxclockskew="00:05:00" negotiationtimeout="00:01:00" replaywindow="00:05:00" inactivitytimeout="00:02:00" sessionkeyrenewalinterval="15:00:00" sessionkeyrolloverinterval="00:05:00" reconnecttransportonfailure="true" maxpendingsessions="128" maxcachedcookies="1000" timestampvalidityduration="00:05:00" /> <secureconversationbootstrap /> </security> <textmessageencoding maxreadpoolsize="64" maxwritepoolsize="16" messageversion="soap12" writeencoding="utf-8"> <readerquotas maxdepth="32" maxstringcontentlength="8192" maxarraylength="16384" maxbytesperread="4096" maxnametablecharcount="16384" /> </textmessageencoding> <httpstransport manualaddressing="false" maxbufferpoolsize="524288" maxreceivedmessagesize="65536" allowcookies="false" authenticationscheme="anonymous" bypassproxyonlocal="false" decompressionenabled="true" hostnamecomparisonmode="strongwildcard" keepaliveenabled="true" maxbuffersize="65536" proxyauthenticationscheme="anonymous" realm="" transfermode="buffered" unsafeconnectionntlmauthentication="false" usedefaultwebproxy="true" requireclientcertificate="false" /> </binding> </custombinding> </bindings>
thanks
edit:
after adislav's replay tryed with:
// configure security properties asymmetricsecuritybindingelement security = securitybindingelement.createmutualcertificateduplexbindingelement(messagesecurityversion.default); security.defaultalgorithmsuite = securityalgorithmsuite.basic256sha256rsa15; security.securityheaderlayout = securityheaderlayout.lax; security.allowserializedsigningtokenonreply = true; security.keyentropymode = securitykeyentropymode.combinedentropy; security.messageprotectionorder = messageprotectionorder.signbeforeencrypt; security.requiresignatureconfirmation = false; // configure encoding properties textmessageencodingbindingelement encoding = new textmessageencodingbindingelement(); // configure transport properties httpstransportbindingelement transport = new httpstransportbindingelement(); custombinding custombinding = new custombinding(security, encoding, transport);
but code doesn't work. miss?
thanks
you have use system.servicemodel.channels.custombinding
class , related binding elements (from same namespace):
var security = securitybindingelement.createmutualcertificateduplexbindingelement(messagesecurityversion.default); // configure security properties var encoding = new textmessageencodingbindingelement(); // configure encoding properties var transport = new httpstransportbindingelement(); // configure transport properties var custombinding = new custombinding(security, encoding, transport);
Comments
Post a Comment