1

次の関数を使用しSystem.ServiceModel.EndpointAddressて、WCF サービスに接続するときにを作成しています。

private static EndpointAddress GetEndPointAddress(string url, EndpointIdentity identity)
{
    Uri baseAddress = new Uri(url);
    EndpointAddress endpointAddress = new EndpointAddress(
        baseAddress,
        identity,
        new AddressHeaderCollection());
    return endpointAddress;
}

EndPointIdentityweb.config からの次の抜粋と相関する を渡す必要があります。

<identity>
  <dns value="Some Value" />
</identity>

私の WCF サービスは X509 証明書を使用しているため、ID のタイプは である必要があるようですX509CertificateEndpointIdentity。このためのコンストラクターでは、証明書を渡す必要があります...しかし、上記のように dns 値を渡したいです。

私のアプローチの何が問題なのか、誰かが提案できますか?

4

1 に答える 1

7

実際、次のように DnsEndpointIdentity を作成する必要がありました。

DnsEndpointIdentity identity = new DnsEndpointIdentity("Some value");
于 2009-04-30T09:15:35.060 に答える