2013-01-09 15 views
9

我想访问一个wcf客户端。我知道人们现在正在从中获取信息,所以我知道它是有效的。我的问题是我似乎无法通过它。该服务是一项相互认证的服务。我在本地计算机上的个人商店中拥有相应的证书。即使有,我得到下面的异常:SSPI:用户原理名称WCF客户端

A call to SSPI failed, see inner exception 

深搜索到的异常,我看到这一点:

Message : The target principal name is incorrect 

我怎样才能解决这个问题?我是否需要模拟应用程序池正在运行的用户?我是否需要添加Identity \ ServicePrincipleName或Identity \ UserPrincipleName?有没有人遇到类似这样的问题?

回答

0

我重新生成了客户端,并且output.config文件中的端点现在在端点标记中有<identity> <userPrincipalName value="[email protected]" /> </identity> 。因此,新的端点看起来像 -

<endpoint address="net.tcp://machinename:6001/ReferenceDataService" binding="netTcpBinding" bindingConfiguration="netTcpBindingConf" contract="IReferenceDataService" > 
    <identity> 
<userPrincipalName value="[email protected]" /> 

这解决了我的问题

+0

如果有人不熟悉WCF - 我使用svcutil.exe重新生成客户端,并使用它生成output.config。 – rhinobear

0

对我来说,当我指定的服务器的用户名在端点工作。不是客户的用户名。这是一个UPN,而不是一个SPN。

new EndpointAddress(
    new Uri("net.tcp://server:1234/MyWcf/svc"), 
     EndpointIdentity.CreateUpnIdentity("[email protected]")) 

从我所了解的情况来看,客户端验证它正在与预期的用户交谈。