WCF 使用 Kerberos 配置 CustomBinding

发布于 2024-11-15 08:43:55 字数 386 浏览 0 评论 0原文

我希望能够为自定义绑定指定安全级别,就像使用 basicHttpBinding 一样。

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

当它不被接受时,如何正确地做到这一点?

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">
          <transport clientCredentialType="Windows"/>
      </security>
    </binding>
  </customBinding>

How does one do this correctly as its not accepted?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

涫野音 2024-11-22 08:43:55

添加 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 应用程序不会为您的客户端存根生成行为,您必须手动添加它。这让我有一段时间了!

<client>
          <endpoint address="..."
              binding="customBinding" bindingConfiguration="..."
              contract="..." name="..."  behaviorConfiguration="ImpersonationBehavior" />        
        </client>
        <behaviors>
          <endpointBehaviors>
            <behavior name="ImpersonationBehavior">
              <clientCredentials>
                <windows allowedImpersonationLevel="Impersonation"/>
              </clientCredentials>
            </behavior>            
          </endpointBehaviors>          
        </behaviors>

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>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文