CustomBinding Constructor (String, String, BindingElement[])
.NET Framework 3.5
Initializes a new instance of the CustomBinding class from an array of binding elements with a specified name and namespace.
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.
| Exception | Condition |
|---|---|
| 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);
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
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.