断开连接的域客户端上出现 SecurityNegotiationException
当我在开发计算机上运行 WCF 服务时,只要客户端连接到域,它就可以工作。
当机器断开连接时,我收到以下异常:
System.ServiceModel.Security.SecurityNegotiationException:对 SSPI 的调用失败,请参阅内部异常。 System.Security.Authentication.AuthenticationException:对 SSPI 的调用失败,请参阅内部异常。 ---> System.ComponentModel.Win32Exception:系统检测到可能存在危害安全的尝试。 请确保您可以联系对您进行身份验证的服务器
该服务在内部使用安全性 (
),因此我无法轻松将其关闭。
有没有办法解决这个问题,以便我可以在未连接时测试服务?
When I am running a WCF service on my development machine it works as long as the client is connected to the domain.
When the machine is disconnected I get the following exception:
System.ServiceModel.Security.SecurityNegotiationException: A call to SSPI failed, see inner exception.
System.Security.Authentication.AuthenticationException: A call to SSPI failed, see inner exception. --->
System.ComponentModel.Win32Exception: The system detected a possible attempt to compromise security.
Please ensure that you can contact the server that authenticated you
The service uses security internally (<transport clientCredentialType="Windows" protectionLevel="None"/>
) so I can't easily turn it off.
Is there a way to work around this problem so I can test the service when I am not connected?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
未连接到域时可能无法工作。
多个绑定的默认 WCF 安全性是“Windows”,例如,您当前的用户凭据将传递到 WCF 服务,然后该服务会尝试根据 Windows 域验证这些用户凭据。
如果您未连接,则无法进行验证,因此 WCF 服务将拒绝调用。我想说的是,按照设计工作:-)
也许您可以公开不需要 Windows 身份验证的服务的第二个端点(“本地开发测试”)?离开域时,只需连接到该非安全端点,以便您至少可以测试服务及其内部工作原理。
Probably won't work when not connected to the domain.
The default WCF security for several bindings is "Windows", e.g. your current user credentials are being passed to the WCF service and the service then attempts to validate those user credentials against the Windows domain.
If you're not connected, that verification can't happen, so the WCF service will refuse the call. Works as designed, I'd say :-)
Maybe you could expose a second endpoint for your service ("local dev testing") that doesn't require Windows authentication? When off the domain, just connect to that non-secured endpoint so that you can at least test the service and its inner workings.
解决方法包括从客户端应用程序中删除 UserPrincipal(在 app.config 中)
The workaround for this involves removing the UserPrincipal from the Client Application (in the app.config)
当您未连接到域
引用时,尝试删除用于本地开发测试的标识元素 -
http://blogs.msdn.com/b/jpsanders/archive/2010/ 10/14/wcf-client-inner-exception-quot-the-security-support-provider-interface-sspi-negotiation-failed-quot.aspx
try to remove identity element for local dev testing when you are not connected to the domain
reference -
http://blogs.msdn.com/b/jpsanders/archive/2010/10/14/wcf-client-inner-exception-quot-the-security-support-provider-interface-sspi-negotiation-failed-quot.aspx