Freigeben über


ServiceEndpoint.Contract Eigenschaft

Definition

Ruft den Vertrag für den Dienstendpunkt ab.

public:
 property System::ServiceModel::Description::ContractDescription ^ Contract { System::ServiceModel::Description::ContractDescription ^ get(); void set(System::ServiceModel::Description::ContractDescription ^ value); };
public:
 property System::ServiceModel::Description::ContractDescription ^ Contract { System::ServiceModel::Description::ContractDescription ^ get(); };
public System.ServiceModel.Description.ContractDescription Contract { get; set; }
public System.ServiceModel.Description.ContractDescription Contract { get; }
member this.Contract : System.ServiceModel.Description.ContractDescription with get, set
member this.Contract : System.ServiceModel.Description.ContractDescription
Public Property Contract As ContractDescription
Public ReadOnly Property Contract As ContractDescription

Eigenschaftswert

Die ContractDescription, die den Vertrag für den Dienstendpunkt angibt.

Beispiele

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

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

Console.WriteLine("Service endpoint {0} contains the following:", endpoint.Name);
Console.WriteLine("Binding: {0}", endpoint.Binding.ToString());
Console.WriteLine("Contract: {0}", endpoint.Contract.ToString());
Console.WriteLine("ListenUri: {0}", endpoint.ListenUri.ToString());
Console.WriteLine("ListenUriMode: {0}", endpoint.ListenUriMode.ToString());
Dim baseAddress As New Uri("http://localhost:8001/Simple")
Dim serviceHost As New ServiceHost(GetType(CalculatorService), baseAddress)

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

Console.WriteLine("Service endpoint {0} contains the following:", endpoint.Name)
Console.WriteLine("Binding: {0}", endpoint.Binding.ToString())
Console.WriteLine("Contract: {0}", endpoint.Contract.ToString())
Console.WriteLine("ListenUri: {0}", endpoint.ListenUri.ToString())
Console.WriteLine("ListenUriMode: {0}", endpoint.ListenUriMode.ToString())

Hinweise

Jeder Dienstendpunkt weist einen eindeutigen Vertrag auf. Über die ContractDescription kann auf die OperationDescriptionCollection für die Methoden im Vertrag mithilfe der Operations-Eigenschaft zugegriffen werden.

Gilt für: