我有一个客户端在两个端点上使用以下内容连接到 WCF 服务:
<security mode="Message">
<message clientCredentialType="Windows" />
</security>
这适用于我的开发环境(均在本地运行)并且协商正常进行。当我将它推送到测试环境时,我收到以下消息:
SOAP security negotiation with 'http://host/service' for target 'http://host/service' failed. See inner exception for more details.
内部异常:
System.ComponentModel.Win32Exception: Security Support Provider Interface (SSPI) authentication failed. The server may not be running in an account with identity 'host/server-name.domain'. If the server is running in a service account (Network Service for example), specify the account's ServicePrincipalName as the identity in the EndpointAddress for the server. If the server is running in a user account, specify the account's UserPrincipalName as the identity in the EndpointAddress for the server.
在随机更改属性并通常乱七八糟之后,我让它工作的唯一方法是更改服务的应用程序池以使用 LocalSystem 作为身份。这随后导致系统管理员生了小猫,这不是我可以继续做的事情。
谁能解释为什么会这样?客户端 Windows 帐户和 AppPool 的身份都在同一个域中。该服务在同一域中的服务器上运行。
最佳答案
如果身份验证适用于 LocalSystem 而不是域帐户,则可能是您缺少域帐户的 SPN。此页面提供了有关配置您的服务运行身份的一些背景信息:http://msdn.microsoft.com/en-us/library/bb628618.aspx
关于c# - 使用 Windows 安全连接到 WCF 服务时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9975521/