英語で読む

次の方法で共有


ServiceDescription.Endpoints プロパティ

定義

サービスの説明からエンドポイントのコレクションを取得します。

public System.ServiceModel.Description.ServiceEndpointCollection Endpoints { get; }

プロパティ値

サービスに定義されたエンドポイントを含む ServiceEndpointCollection

// Iterate through the endpoints contained in the ServiceDescription
ServiceEndpointCollection sec = svcDesc.Endpoints;
foreach (ServiceEndpoint se in sec)
{
    Console.WriteLine("Endpoint:");
    Console.WriteLine("\tAddress: {0}", se.Address.ToString());
    Console.WriteLine("\tBinding: {0}", se.Binding.ToString());
    Console.WriteLine("\tContract: {0}", se.Contract.ToString());
    KeyedByTypeCollection<IEndpointBehavior> behaviors = se.Behaviors;
    foreach (IEndpointBehavior behavior in behaviors)
    {
        Console.WriteLine("Behavior: {0}", behavior.ToString());
    }
}

注釈

このメソッドによって返される ServiceEndpointCollection に含まれるエンドポイントには、サービスとの通信に必要なアドレス、バインディング、コントラクト、および動作の情報がそれぞれ含まれます。 この情報にアクセスするには、関連する検索基準を使用して ServiceEndpoint メソッドを実行して、コレクションから Find を取得する必要があります。 その後、ServiceEndpoint プロパティを使用して情報にアクセスします。 たとえば、ContractDescription プロパティを使用して Contract にアクセスできます。

ServiceEndpoint をパラメーターとして ExportEndpoint(ServiceEndpoint) に渡すことにより、サービス エンドポイントについてのメタデータをエクスポートします。

適用対象

製品 バージョン
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1