首页 > 解决方案 > 更改密码后 WCF 服务上的 Windows 身份验证失败

问题描述

我们有一个 Windows 服务托管一些使用 wsHttpBindings 进行身份验证的 wcf Web 服务。一位用户遇到了身份验证问题,结果发现她的密码已过期。然后她更改了密码并重新启动了计算机。更改密码后,她无法再访问 Web 服务。她收到

System.ServiceModel.Security.SecurityNegotiationException: The caller was not authenticated by the service. ---> System.ServiceModel.FaultException: The request for security token could not be satisfied because authentication failed.

在服务器上,我们启用了服务跟踪,当用户尝试调用服务时出现错误:

System.ComponentModel.Win32Exception (0x80004005): The Security Support Provider Interface (SSPI) negotiation failed.

然后,我们检查了服务器上事件视图中的 Windows 日志 -> 安全性并找到

帐户无法登录。

Subject:
    Security ID:        NULL SID
    Account Name:       -
    Account Domain:     -
    Logon ID:       0x0

Logon Type:         3

Account For Which Logon Failed:
    Security ID:        NULL SID
    Account Name:       user@compyany.com
    Account Domain:     

Failure Information:
    Failure Reason:     Unknown user name or bad password.
    Status:         0xc000006d
    Sub Status:     0xc0000064

我们曾尝试再次重置她的密码,但没有帮助。

标签: c#windowswcfwcf-security

解决方案


Control Panel -> User Accounts -> Manage your credentials -> Windows Credentials

列表中有一个条目指向我们无法访问的服务器。我们删除了它,用户可以毫无问题地访问该服务。

用户似乎使用 mstsc 或类似工具访问了服务器,并输入了 upn 用户名格式 user@company.com 并保存了密码。当她更改密码时,这并没有得到更新,并且由于某种原因,wcf 在访问服务时使用这些凭据而不是默认凭据。


推荐阅读