【问题标题】:Using Microsoft integrated windows authentication with WCF but without IIS使用带有 WCF 但没有 IIS 的 Microsoft 集成 Windows 身份验证
【发布时间】:2016-12-21 07:45:43
【问题描述】:

有没有办法获得 Microsoft 集成 Windows 身份验证的行为而无需使用 IIS 进行部署?我们有自己的独立 C#/WCF WebServer,我们想添加这个功能。我们不能将 IIS 用作部署的一部分。

【问题讨论】:

    标签: wcf windows-authentication


    【解决方案1】:

    WCF 是“自托管”。这意味着,您不必拥有 IIS 即可在服务器上运行它(当然取决于您的实现)。您甚至可以在客户的计算机上运行它。

    有关 WCF 身份验证的更多信息,请参阅本文:

    Authentication and Authorization in WCF Services

    还有这篇文章中的一个例子:

    Authenticate with a User Name and Password

    【讨论】:

      【解决方案2】:

      您可以设置ClientCredentialType

      WebHttpBinding whb = ... ;
      whb.Security.Transport.ClientCredentialType = HttpClientCredentialType.Windows;
      

      然后通过

      获取 WindowsIdentity
      WindowsIdentity identity =  ServiceSecurityContext.Current.WindowsIdentity;
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2011-07-22
        • 2010-12-13
        • 2011-06-08
        • 1970-01-01
        • 1970-01-01
        • 2013-02-22
        • 1970-01-01
        相关资源
        最近更新 更多