加入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