WCF Configuring CustomBinding with Kerberos
I want to be able to specify a security level for my custom binding the same way you do with an basicHttpBinding.
<customBinding>
<binding name="jsonpBinding" >
....
<security mode="TransportCredentialOnly">
开发者_如何学Go <transport clientCredentialType="Windows"/>
</security>
</binding>
</customBinding>
How does one do this correctly as its not accepted?
Adding authenticationScheme="Negotiate"
resolved the issue.
Add this to your WCF method
[OperationBehavior(Impersonation = ImpersonationOption.Required)]
public int Dosomething()
{
...
}
Add this to your WCF web.config
<customBinding>
<binding name="jsonpBinding" >
<jsonMessageEncoding/>
<httpTransport manualAddressing="true" authenticationScheme="Negotiate"/>
</binding>
</customBinding>
Adding the following to your client (MVC Web App in my case). Its worth noting that the svcutil application does not generate the behavior for your client stub and you have to add it manualy. This had me for some time!
<client>
<endpoint address="..."
binding="customBinding" bindingConfiguration="..."
contract="..." name="..." behaviorConfiguration="ImpersonationBehavior" />
</client>
<behaviors>
<endpointBehaviors>
<behavior name="ImpersonationBehavior">
<clientCredentials>
<windows allowedImpersonationLevel="Impersonation"/>
</clientCredentials>
</behavior>
</endpointBehaviors>
</behaviors>
精彩评论