Condividi tramite


Using the <endpoint> Element to Configure a Service Endpoint

Specifies binding, contract, and address properties for a service endpoint, which is used to expose services.

<system.serviceModel>

  <client>

    <endpoint>

                                    
                                    <endpoint address="String"
                                
                                    
                                       behaviorConfiguration="String"
                                
                                    
                                       binding="String"
                                
                                    
                                       bindingConfiguration="String"
                                
                                    
                                       bindingName="String"
                                
                                    
                                       bindingNamespace="String"
                                
                                    
                                       contract="String"
                                
                                    
                                           
                                    
                                       listenUriMode="Explicit/Unique"
                                
                                    
                                       listenUri="Uri"
                                
                                    
                                    </endpoint>
                                

Attributes and Elements

The following sections describe attributes, child elements, and parent elements.

Attributes

Attribute Description

address

A string that contains the address of the endpoint. The address can be specified as an absolute or relative address. If a relative address is provided, the host is expected to provide a base address appropriate for the transport scheme used in the binding. If an address is not configured, the base address is assumed to be the address for that endpoint.

The default is an empty string.

behaviorConfiguration

A string that contains the name of the behavior to be used in the endpoint.

binding

Required string attribute.

Specifies the type of binding to use. The type must have a registered configuration section in order to be referenced. The type is the registered by section name, rather than by the type name of the binding.

bindingConfiguration

A string that specifies the binding name of the binding to use when the endpoint is instantiated. The binding name must be in scope at the point the endpoint is defined. The default is an empty string.

This attribute is used in conjunction with binding to reference a specific binding configuration in the configuration file. Set this attribute if you are attempting to use a custom binding. Otherwise, an exception may be thrown.

bindingName

A string that specifies the unique qualified name of the binding for definition export through WSDL. The default is an empty string.

bindingNamespace

A string that specifies the qualified name of the namespace of the binding for definition export through WSDL. The default is an empty string.

contract

A string that indicates which contract this endpoint is exposing. The assembly must implement the contract type. If a service implementation implements a single contract type, then this property can be omitted. The default is an empty string.

listenUriMode

Specifies how the transport treats the ListenUri provided for the service to listen on. Valid values are

  • Explicit

  • Unique

The default value is Explicit.

listenUri

A string that specifies the URI at which the service endpoint listens. The default is an empty string.

Child Elements

Element Description

<headers>

A collection of address headers.

<identity>

An identity that enables the authentication of an endpoint by other endpoints exchanging messages with it.

Parent Elements


Element Description

<client>

A configuration section that defines a list of endpoints that a client can connect to.

Example

This is an example of a service endpoint configuration.

<endpoint 
    address="/HelloWorld/"
    bindingConfiguration="usingDefaults"
    bindingName="MyBinding"
    binding="customBinding"
    contract="HelloWorld">
    <Headers>
       <Region xmlns="http://tempuri.org/">EastCoast</Region>
       <Member xmlns="http://tempuri.org/">Gold</Member>
    </Headers>
</endpoint>

See Also

Reference

ServiceEndpointElement

Footer image

Send comments about this topic to Microsoft.
© Microsoft Corporation. All rights reserved.