次の関数を使用し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;
}
EndPointIdentity
web.config からの次の抜粋と相関する を渡す必要があります。
<identity>
<dns value="Some Value" />
</identity>
私の WCF サービスは X509 証明書を使用しているため、ID のタイプは である必要があるようですX509CertificateEndpointIdentity
。このためのコンストラクターでは、証明書を渡す必要があります...しかし、上記のように dns 値を渡したいです。
私のアプローチの何が問題なのか、誰かが提案できますか?