【发布时间】:2010-11-24 15:44:49
【问题描述】:
我正在尝试为 WCF 服务构建一个最小客户端,通过直接通道接口使用带有 SecurityMode: Message 的 WSHttpBinding。
我现在的代码很简单:
EndpointIdentity i = EndpointIdentity.CreateX509CertificateIdentity(clientCertificate);
EndpointAddress a = new EndpointAddress(new Uri("http://myServerUrl"), i);
WSHttpBinding b= new WSHttpBinding(SecurityMode.Message);
ChannelFactory<IRequestChannel> channelFactory = new ChannelFactory<IRequestChannel>(b, a);
channelFactory.Open();
IRequestChannel channel = channelFactory.CreateChannel();
channel.Open();
Message response = channel.Request(requestMessage);
clientCertificate 被正确加载。 但是,之后,我不确定我是否以正确的方式调用每个函数。
事实是:代码的最后一行 sn -p 抛出一个MessageSecurityException 内容
为了 SspiNegotiation/Kerberos 的目的,客户端无法根据目标地址“http://myServerUrl”中的身份确定服务主体名称。目标地址身份必须是 UPN 身份(如 acmedomain\alice)或 SPN 身份(如 host/bobs-machine)。
这个问题的原因可能是什么?
【问题讨论】:
标签: wcf wcf-client ws-security x509certificate2 wshttpbinding