加入authenticationScheme="Negotiate"
解决了这个问题。
添加到您的WCF方法
[OperationBehavior(Impersonation = ImpersonationOption.Required)]
public int Dosomething()
{
...
}
添加到您的WCF的web.config
<customBinding>
<binding name="jsonpBinding" >
<jsonMessageEncoding/>
<httpTransport manualAddressing="true" authenticationScheme="Negotiate"/>
</binding>
</customBinding>
添加以下到您的客户端(MVC Web应用程序在我的情况)。值得注意的是,svcutil应用程序不会为您的客户端存根产生行为,您必须将其添加为manualy。这让我有一段时间!
<client>
<endpoint address="..."
binding="customBinding" bindingConfiguration="..."
contract="..." name="..." behaviorConfiguration="ImpersonationBehavior" />
</client>
<behaviors>
<endpointBehaviors>
<behavior name="ImpersonationBehavior">
<clientCredentials>
<windows allowedImpersonationLevel="Impersonation"/>
</clientCredentials>
</behavior>
</endpointBehaviors>
</behaviors>
你甚至尝试使用谷歌搜索“wcf kerberos”吗?这回答了你的问题了吗?第一个结果:http://stackoverflow.com/questions/1295526/wcf-and-kerberos-authentication – Amy 2011-06-13 17:31:20
@Inuyasha这是特定于CustomBinding它与basicHttpBinding工作正常。 – Jonathan 2011-06-13 17:33:46