我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 证书,因此我的身份似乎需要是X509CertificateEndpointIdentity
. 为此的构造函数需要我传递一个证书……但我想传递一个 dns 值,如上所示。
谁能建议我的方法有什么问题?