Editare

Partajați prin


ServiceEndpoint Class

Definition

Represents the endpoint for a service that allows clients of the service to find and communicate with the service.

public ref class ServiceEndpoint
public class ServiceEndpoint
type ServiceEndpoint = class
Public Class ServiceEndpoint
Inheritance
ServiceEndpoint
Derived

Examples

Uri baseAddress = new Uri("http://localhost:8001/Simple");
ServiceHost serviceHost = new ServiceHost(typeof(CalculatorService), baseAddress);

ContractDescription cd = new ContractDescription("Calculator");
ServiceEndpoint svcEndpoint = new ServiceEndpoint(cd);

ServiceEndpoint endpnt = serviceHost.AddServiceEndpoint(
    typeof(ICalculator),
    new WSHttpBinding(),
    "CalculatorServiceObject");

Console.WriteLine("Address: {0}", endpnt.Address);

// Enable Mex
ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
smb.HttpGetEnabled = true;
serviceHost.Description.Behaviors.Add(smb);

serviceHost.Open();
Dim baseAddress As New Uri("http://localhost:8001/Simple")
Dim serviceHost As New ServiceHost(GetType(CalculatorService), baseAddress)

Dim cd As New ContractDescription("Calculator")
Dim svcEndpoint As New ServiceEndpoint(cd)

Dim endpnt As ServiceEndpoint = serviceHost.AddServiceEndpoint(GetType(ICalculator), New WSHttpBinding(), "CalculatorServiceObject")

Console.WriteLine("Address: {0}", endpnt.Address)

' Enable Mex
Dim smb As New ServiceMetadataBehavior()
smb.HttpGetEnabled = True
serviceHost.Description.Behaviors.Add(smb)

serviceHost.Open()

Remarks

The service endpoint contains the information about the address, binding, contract, and behavior required by a client to find and interact with the service at this endpoint.

Constructors

ServiceEndpoint(ContractDescription)

Initializes a new instance of the ServiceEndpoint class for a specified contract.

ServiceEndpoint(ContractDescription, Binding, EndpointAddress)

Initializes a new instance of the ServiceEndpoint class with a specified contract, binding, and address.

Properties

Address

Gets or sets the endpoint address for the service endpoint.

Behaviors

Gets the behaviors for the service endpoint.

Binding

Gets or sets the binding for the service endpoint.

Contract

Gets the contract for the service endpoint.

EndpointBehaviors

Gets the endpoint behaviors for the service.

IsSystemEndpoint

Gets or sets whether the service endpoint is generated by the system as opposed to being user-defined.

ListenUri

Gets or sets the URI at which the service endpoint listens.

ListenUriMode

Gets or sets how the transport handles the URI that is provided for the service to listen on.

Name

Gets or sets the name of the service endpoint.

Methods

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to