【问题标题】:What is the equivalent of passing DefaultCredentials in WCF?在 WCF 中传递 DefaultCredentials 的等价物是什么?
【发布时间】:2010-11-19 03:39:44
【问题描述】:

This answer 解释说,在调用 .asmx Web 服务时,无需指定要使用的身份验证类型:


WebServiceProxy proxy = new WebServiceProxy(); // Derived from SoapHttpClientProtocol

proxy.Credentials = CredentialCache.DefaultCredentials;

此方法适用于 NTLM 和 Kerberos 身份验证。它将传递运行代码的 Windows 帐户的凭据。


什么是 WCF 中的等价物,同时适用于 NTLM 和 Kerberos 环境?

【问题讨论】:

    标签: wcf credentials kerberos ntlm


    【解决方案1】:

    在 WCF 中,您需要在 WCF 服务的绑定中指定身份验证。确保客户端和服务器使用相同的身份验证方案。

    web.config:

    <binding name="WindowsClientOverTcp">
        <security mode="Transport">
            <transport clientCredentialType="Windows" />
        </security>
    </binding>
    

    【讨论】:

    • 那么有没有办法避免指定认证呢?也就是说,你需要知道环境是 Kerberos 还是 NTLM?
    • 使用Kerberos你的客户端和服务器需要满足一些特定条件才能使用,否则windows认证会默认使用NTLM
    猜你喜欢
    • 1970-01-01
    • 2021-06-19
    • 2014-05-08
    • 2014-06-12
    • 1970-01-01
    • 2022-11-28
    • 1970-01-01
    • 2014-10-09
    • 2023-03-07
    相关资源
    最近更新 更多