c# - 使用 Windows 安全连接到 WCF 服务时出错

标签 c# .net wcf iis windows-authentication

我有一个客户端在两个端点上使用以下内容连接到 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/

相关文章:

c# - 计算执行时间

c# - 如何使图像在 wpf 中的鼠标悬停事件中增长 x %?

c# - 使用 DataTable.Compute 方法获取转换后的字符串列的总和的 SyntaxErrorException

wcf : string element nillable ="false"

iphone - 从 .NET WCF4 Web 服务返回 .plist

wcf - 如何在发送形状之前保留 BizTalk 业务流程 - 用于重新发送

c# - Kernel32.dll 中的 CreateFile 不允许我打开物理磁盘

c# - 使用 nhibernate 映射递归关联

.net - 将 XSLT 应用于 ASP.NET 上的 XML

.net - 如何在.NET中获取本地化的标点符号规则?