收到“安全支持提供商接口 (SSPI) 协商失败”使用 ServiceHostFactory 时

发布于 2024-09-16 15:04:00 字数 298 浏览 4 评论 0原文

我最近开始使用自定义 ServiceHostFactory,因为我想使用 WCF 的依赖注入。我的客户端和服务都在我的本地计算机上从 VS2010 运行,并且该服务使用 ASP.NET 开发服务器。为什么我现在遇到这个问题?我过去在 wsHttpSecurity 方面取得了成功,客户端和服务都在我的本地计算机上。我真的认为这里唯一的区别是 ServiceHostFactory 的使用。我尝试过使用 userPrincipalName 属性,但我什至不确定应该为该值输入什么。应该是 MachineName\username 吗?这个属性会产生影响吗?我非常感谢您提供的任何帮助。

I recently started using a custom ServiceHostFactory because I want to use dependency injection with WCF. Both my client and service are being run from VS2010 on my local machine and the service is using the ASP.NET Development Server. Why am I having this problem now? I've had success with wsHttpSecurity in the past, having both the client and service on my local machine. I really think the only difference here is the use of a ServiceHostFactory. I've tried using the userPrincipalName attribute but I'm not even sure what I should be putting in for the value. Should it be MachineName\username? Will this attribute make a difference? I'd greatly appriciate any help you can provide.

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

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

发布评论

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

评论(1

好多鱼好多余 2024-09-23 15:04:00

UserNamePrincipal 描述服务凭证。如果您将 UPN 设置为某个帐户,则您声明该服务将托管在该帐户下运行的进程中。该信息以 WSDL 形式传递给客户端。当客户端打开服务通道时,它首先验证服务是否在声明的帐户下运行(某些安全握手)。如果不是,则会抛出异常,因为服务未经过身份验证。如果您在开发服务器上运行该服务,则必须将 UPN 设置为您当前的帐户。

UserNamePrincipal describes service credentials. If you set UPN to some account you claim that service will be hosted in process running under that account. This information is passed in WSDL to client. When client opens channel to the service it first validate that service is running under claimed account (some security handshake). If not exception is thrown because service is not authenticated. If you run the service on development server you have to set UPN to your current account.

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