简体   繁体   English

WCF 使用 Kerberos 配置 CustomBinding

[英]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.我希望能够像使用 basicHttpBinding 一样为自定义绑定指定安全级别。

  <customBinding>
    <binding name="jsonpBinding" >      
      ....                
      <security mode="TransportCredentialOnly">
          <transport clientCredentialType="Windows"/>
      </security>
    </binding>
  </customBinding>

How does one do this correctly as its not accepted?一个人如何正确地做到这一点,因为它不被接受?

Adding authenticationScheme="Negotiate" resolved the issue.添加authenticationScheme="Negotiate"解决了这个问题。

Add this to your WCF method将此添加到您的 WCF 方法中

[OperationBehavior(Impersonation = ImpersonationOption.Required)]
public int Dosomething()
{
...
}

Add this to your WCF web.config将此添加到您的 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).将以下内容添加到您的客户端(在我的情况下为 MVC Web App)。 Its worth noting that the svcutil application does not generate the behavior for your client stub and you have to add it manualy.值得注意的是,svcutil 应用程序不会为您的客户端存根生成行为,您必须手动添加它。 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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM