Skip to main content
.NET Framework 4.6.2+

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

WcfDataServerHelper.CreateNetTcpBinding() Method

Creates a NetTcpBinding object that you can use in the Middle Tier Security scenario.

Namespace: DevExpress.ExpressApp.Security.ClientServer.Wcf

Assembly: DevExpress.ExpressApp.Security.Xpo.v24.2.dll

#Declaration

public static Binding CreateNetTcpBinding()

#Returns

Type Description
Binding

A NetTcpBinding object that you can use in the Middle Tier Security scenario.

#Remarks

To reduce the volume of code required to implement the WCF Application Server, we have moved the Binding object initialization to this helper method. Its internal implementation is shown below.

public static System.ServiceModel.Channels.Binding CreateNetTcpBinding() {
    NetTcpBinding binding = new NetTcpBinding();
    binding.MaxReceivedMessageSize = Int32.MaxValue;
    binding.MaxBufferPoolSize = Int32.MaxValue;
    binding.ReceiveTimeout = TimeSpan.FromHours(24);
    binding.ReaderQuotas.MaxArrayLength = Int32.MaxValue;
    binding.ReaderQuotas.MaxBytesPerRead = Int32.MaxValue;
    binding.ReaderQuotas.MaxStringContentLength = Int32.MaxValue;
    binding.ReaderQuotas.MaxDepth = Int32.MaxValue;
    binding.ReaderQuotas.MaxNameTableCharCount = Int32.MaxValue;
    return binding;
}

You can pass this method result to the AddServiceEndpoint method, when configuring the ServiceHost object.

ServiceHost serviceHost = new ServiceHost(new WcfSecuredDataServer(dataServer));
serviceHost.AddServiceEndpoint(typeof(IWcfSecuredDataServer), 
    WcfDataServerHelper.CreateNetTcpBinding(), "http://localhost:1451/DataServer");
serviceHost.Open();

The complete example is provided in the Middle Tier Security topic.

If you want to use custom Binding, do not use the CreateNetTcpBinding method - create the required Binding object yourself and pass it to the AddServiceEndpoint method.

See Also