共用方式為


ServiceEndpoint.ListenUri 屬性

定義

取得或設定服務端點接聽的 URI。

public:
 property Uri ^ ListenUri { Uri ^ get(); void set(Uri ^ value); };
public Uri ListenUri { get; set; }
member this.ListenUri : Uri with get, set
Public Property ListenUri As Uri

屬性值

Uri

服務端點接聽的 Uri。 預設值是由 Uri 傳回的 EndpointAddressAddress 所提供。

範例

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())

備註

也可以使用 ListenUri 屬性設定此值。

適用於