在 WCF 中传递 DefaultCredentials 相当于什么?

发布于 2024-10-03 15:57:32 字数 487 浏览 0 评论 0原文

这个答案 解释了调用 .asmx Web 服务时无需指定要使用的身份验证类型:


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

proxy.Credentials = CredentialCache.DefaultCredentials;

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


在 NTLM 和 Kerberos 环境中都有效的 WCF 中的等效项是什么?

This answer explains that when calling a .asmx web service there's no need to specify which authentication type to use:


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

proxy.Credentials = CredentialCache.DefaultCredentials;

This method works for both NTLM and Kerberos authentication. It will pass the credentials of the windows account under which the code is running.


What is the equivalent in WCF, that works in both NTLM and Kerberos environments?

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

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

发布评论

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

评论(1

二智少女猫性小仙女 2024-10-10 15:57:32

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

网络配置:

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

In WCF you need to specify authentication in the bindings of your WCF services. Make sure the client and server use the same authentication scheme.

web.config:

<binding name="WindowsClientOverTcp">
    <security mode="Transport">
        <transport clientCredentialType="Windows" />
    </security>
</binding>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文