Skip to main content
A newer version of this page is available. .

WcfDataServerHelper.CreateDefaultBinding() Method

Creates a Creates a WSHttpBinding object object that you can use in the Middle Tier Security - WCF Service scenario.

Namespace: DevExpress.ExpressApp.Security.ClientServer.Wcf

Assembly: DevExpress.ExpressApp.Security.Xpo.v19.1.dll

Declaration

public static Binding CreateDefaultBinding()

Returns

Type Description
Binding

A WSHttpBinding object that you can use in the WCF Application Server implementation.

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 CreateDefaultBinding() {
    WSHttpBinding binding = new WSHttpBinding();
    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.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.CreateDefaultBinding(), "http://localhost:1451/DataServer");
serviceHost.Open();

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

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

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the CreateDefaultBinding() method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also