This topic has not yet been rated - Rate this topic

CustomBinding Constructor (String, String, BindingElement[])

Initializes a new instance of the CustomBinding class from an array of binding elements with a specified name and namespace.

Namespace:  System.ServiceModel.Channels
Assembly:  System.ServiceModel (in System.ServiceModel.dll)
public CustomBinding(
	string name,
	string ns,
	params BindingElement[] bindingElementsInTopDownChannelStackOrder
)

Parameters

name
Type: System.String

The name of the binding.

ns
Type: System.String

The namespace of the binding.

bindingElementsInTopDownChannelStackOrder
Type: System.ServiceModel.Channels.BindingElement[]

The Array of type BindingElement used to initialize the custom binding.

ExceptionCondition
ArgumentNullException

bindingElementsInTopDownChannelStackOrder is null.

Uri baseAddress = new Uri("http://localhost:8000/servicemodelsamples/service");

// Create a ServiceHost for the CalculatorService type and provide the base address.
ServiceHost serviceHost = new ServiceHost(typeof(CalculatorService), baseAddress);

// Create a custom binding that contains two binding elements.
ReliableSessionBindingElement reliableSession = new ReliableSessionBindingElement();
reliableSession.Ordered = true;

HttpTransportBindingElement httpTransport = new HttpTransportBindingElement();
httpTransport.AuthenticationScheme = System.Net.AuthenticationSchemes.Anonymous;
httpTransport.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard;

BindingElement[] elements = new BindingElement[2];
elements[0] = reliableSession;
elements[1] = httpTransport;

CustomBinding binding = new CustomBinding("MyCustomBinding", "http://localhost/service", elements);

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0

.NET Compact Framework

Supported in: 3.5
Did you find this helpful?
(1500 characters remaining)

Community Additions

ADD
© 2013 Microsoft. All rights reserved.