Tuesday, September 25, 2007

NetTcpBinding to CustomBinding conversion - sample

Just to give an idea how to map the bellow netTcpBinding:

<netTcpBinding>
 <binding name="NetTcpBindingConfiguration" closeTimeout="00:01:00" openTimeout="01:01:00" receiveTimeout="01:01:00" 
sendTimeout="01:01:00" transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
hostNameComparisonMode="StrongWildcard" listenBacklog="100" maxBufferPoolSize="524288"
maxBufferSize
="65536" maxConnections="30" maxReceivedMessageSize="65536"> <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead
="4096" maxNameTableCharCount="16384" /> <reliableSession ordered="true" inactivityTimeout="01:01:00" enabled="false" /> <security mode="Transport"> <transport clientCredentialType="Windows"
protectionLevel
="None" /> </security> </binding> </netTcpBinding>

to the customBinding with extra options configured:

<customBinding> 
<binding name="NetTcpBinding_Custom" closeTimeout="01:01:00" openTimeout="01:01:00" 
receiveTimeout
="01:01:00" sendTimeout="01:01:00"> <transactionFlow /> <binaryMessageEncoding /> <windowsStreamSecurity protectionLevel="None" /> <tcpTransport maxBufferPoolSize="524288" maxReceivedMessageSize="99999998"
connectionBufferSize
="8192" hostNameComparisonMode="StrongWildcard"
channelInitializationTimeout
="00:01:00" maxBufferSize="99999998"
maxPendingConnections
="20" maxOutputDelay="00:00:00.2000000" maxPendingAccepts="5"
transferMode
="Buffered" listenBacklog="20" portSharingEnabled="false"
teredoEnabled
="false"> <connectionPoolSettings groupName="default" leaseTimeout="00:05:00"
idleTimeout
="00:02:00" maxOutboundConnectionsPerEndpoint="20" /> </tcpTransport> </binding> </customBinding>

Following references can be of help for other cases:

Internals of NetTcpBinding: http://blogs.msdn.com/drnick/archive/2006/06/05/617703.aspx

Custom Binding Security: http://msdn2.microsoft.com/en-us/library/ms751528.aspx

How To: Create a SecurityBindingElement for a Specified Authentication Mode: http://msdn2.microsoft.com/en-us/library/aa702632.aspx

WindowsStreamSecurityBindingElement Class: http://msdn2.microsoft.com/en-us/library/system.servicemodel.channels.windowsstreamsecuritybindingelement.aspx

SecurityElement: http://msdn2.microsoft.com/en-us/library/system.servicemodel.configuration.securityelement_members.aspx

Post a Comment