Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The solution I ended up going with was modifying <a href="https://github.com/yaronn/ClearUsernameBinding" rel="nofollow">Clear Username Binding</a> to use TCP for transport and binary message encoding. I got the idea from a <a href="http://webservices20.blogspot.com/2008/11/introducing-wcf-clearusernamebinding.html?showComment=1236358080000#c4998609485208401651" rel="nofollow">series of comments</a> on <a href="http://webservices20.blogspot.com/2008/11/introducing-wcf-clearusernamebinding.html" rel="nofollow">the author's blog</a>. The complete code for my binding is below:</p> <pre><code>using System; using System.Configuration; using System.Net.Security; using System.ServiceModel.Channels; using System.ServiceModel.Configuration; namespace ClearTcpBinding { public class ClearTcpBinding : CustomBinding { private long _maxReceivedMessageSize = 65536; public void SetMaxReceivedMessageSize(long value) { _maxReceivedMessageSize = value; } public override BindingElementCollection CreateBindingElements() { var res = new BindingElementCollection { new BinaryMessageEncodingBindingElement {MessageVersion = MessageVersion.Soap12WSAddressing10}, SecurityBindingElement.CreateUserNameOverTransportBindingElement(), new AutoSecuredTcpTransportElement {MaxReceivedMessageSize = _maxReceivedMessageSize} }; return res; } public override string Scheme { get { return "net.tcp"; } } } public class ClearTcpBindingElement : StandardBindingElement { private ConfigurationPropertyCollection _properties; protected override void OnApplyConfiguration(Binding binding) { var b = (ClearTcpBinding)binding; b.SetMaxReceivedMessageSize(Convert.ToInt64(MaxReceivedMessageSize)); } protected override Type BindingElementType { get { return typeof(ClearTcpBinding); } } protected override ConfigurationPropertyCollection Properties { get { if (_properties == null) { var properties = base.Properties; properties.Add(new ConfigurationProperty("maxReceivedMessageSize", typeof(string), "65536")); _properties = properties; } return _properties; } } public string MaxReceivedMessageSize { get { return (string)base["maxReceivedMessageSize"]; } set { base["maxReceivedMessageSize"] = value; } } } public class ClearTcpCollectionElement : StandardBindingCollectionElement&lt;ClearTcpBinding, ClearTcpBindingElement&gt; { } public class AutoSecuredTcpTransportElement : TcpTransportBindingElement, ITransportTokenAssertionProvider { public override T GetProperty&lt;T&gt;(BindingContext context) { if (typeof(T) == typeof(ISecurityCapabilities)) return (T)(ISecurityCapabilities)new AutoSecuredTcpSecurityCapabilities(); return base.GetProperty&lt;T&gt;(context); } public System.Xml.XmlElement GetTransportTokenAssertion() { return null; } } public class AutoSecuredTcpSecurityCapabilities : ISecurityCapabilities { public ProtectionLevel SupportedRequestProtectionLevel { get { return ProtectionLevel.EncryptAndSign; } } public ProtectionLevel SupportedResponseProtectionLevel { get { return ProtectionLevel.EncryptAndSign; } } public bool SupportsClientAuthentication { get { return false; } } public bool SupportsClientWindowsIdentity { get { return false; } } public bool SupportsServerAuthentication { get { return true; } } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload