我需要有关WCF和授权一些帮助。 目前,我有一个客户端,它调用Windows服务和被调用WCF服务(与WsHttpBinding的)托管的.NET远程对象。 WCF服务是使用具有基于消息防盗窗验证。

Windows服务是用特殊帐户运行。 一旦客户呼叫到达的.NET远程对象被Thread.CurrentPrincipal中设置为客户端提供的本金,让所有操作都与来自客户端的凭据执行。 没问题,到目前为止,现在,这里是我当前的问题: WCF服务应与客户端的用户凭据调用。据我所知WCF使用WindowsIdentity.GetCurrent建立呼叫的授权信息。由于持有Thread.CurrentPrincipal中我想用来进行通话的身份,我认为(作为hread.CurrentPrincipal.Identity的WindowsIdentity).Impersonate()做的工作。

但现在我得到的,而不是一个WCF安全异常此异常: System.ComponentModel.Win32Exception:无凭据在安全软件包中

调用堆栈:    在System.IdentityModel.SspiWrapper.AcquireCredentialsHandle(字符串包,CredentialUse意图,AuthIdentityEx&的authData)    在System.ServiceModel.Security.SecurityUtils.GetCredentialsHandle(字符串包,的NetworkCredential凭证,布尔isServer,字符串[] additionalPackages)    在System.ServiceModel.Security.SecurityUtils.GetCredentialsHandle(SecurityBindingElement SBE,ClientCredentials clientCredentials)    在System.ServiceModel.Security.SecurityUtils.GetCredentialsHandle(SecurityBindingElement SBE,的BindingContext上下文)    在System.ServiceModel.Security.SecuritySessionSecurityTokenProvider.OnOpening()    在System.ServiceModel.Security.WrapperSecurityCommunicationObject.OnOpening()    在System.ServiceModel.Channels.CommunicationObject.Open(时间跨度超时)    在System.ServiceModel.Security.CommunicationObjectSecurityTokenProvider.Open(时间跨度超时)    在System.ServiceModel.Security.SecurityUtils.OpenTokenProviderIfRequired(SecurityTokenProvider tokenProvider,时间跨度超时)    在System.ServiceModel.Security.SecuritySessionClientSettings`1.ClientSecuritySessionChannel.OnOpen(时间跨度超时)    在System.ServiceModel.Channels.CommunicationObject.Open(时间跨度超时)    在System.ServiceModel.Channels.ServiceChannel.OnOpen(时间跨度超时)    在System.ServiceModel.Channels.CommunicationObject.Open(时间跨度超时)    在System.ServiceModel.Channels.ServiceChannel.CallOpenOnce.System.ServiceModel.Channels.ServiceChannel.ICallOnce.Call(ServiceChannel信道,时间跨度超时)    在System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce(时间跨度超时,CallOnceManager级联)    在System.ServiceModel.Channels.ServiceChannel.EnsureOpened(时间跨度超时)    在System.ServiceModel.Channels.ServiceChannel.Call(字符串动作,布尔单向,ProxyOperationRuntime操作,对象[]项,对象[]奏,时间跨度超时)    在System.ServiceModel.Channels.ServiceChannel.Call(字符串动作,布尔单向,ProxyOperationRuntime操作,对象[]项,对象[]奏)    在System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage包括MethodCall,ProxyOperationRuntime操作)    在System.ServiceModel.Channels.ServiceChannelProxy.Invoke(即时聊天消息)

THX的任何帮助 马丁

编辑:我犯了一个错误,导致这个例外,因为我忘记了创建冒充后的ChannelFactory,但现在我得到另一个异常,在这里我真的不知道该如何处理它: System.IO.FileLoadException:无法加载文件或程序集System.IdentityModel.Selectors,版本= 3.0.0.0,文化=中性公钥= b77a5c561934e089'或它的一个依赖。无论是需要模拟级别未提供,或提供的模拟级别无效。 (从HRESULT异常:0x80070542)

有帮助吗?

解决方案

这您的窗口服务正在运行作为用户,必须被允许模拟用户。

有一个称为“身份验证后模拟客户端”右

HTTP://博客.technet.com / askperf /存档/ 2007/10/16 / WMI的故障排除-模拟-rights.aspx

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top