简体   繁体   English

模拟错误

[英]Impersonation Error

I am getting the below error in c# code after the impersonation. 模拟后,我在C#代码中收到以下错误。

{"Invalid token for impersonation - it cannot be duplicated."} {“用于模拟的无效令牌-不能重复。”}

It is plain WPF windows application. 它是纯WPF Windows应用程序。 In the begining of the application Impersonated the different user. 在应用程序开始时,模拟了其他用户。 Getting this error in random location. 在随机位置获取此错误。

I had similar issue and the solution is to have impersonation context at the actual task level rather than having all tasks performed under a single impersonation context. 我遇到了类似的问题,解决方案是在实际任务级别上使用模拟上下文,而不是在单个模拟上下文中执行所有任务。 Earlier when I used impersonation context right from the button click event, I was performing all related tasks under the hood, but realized the impersonation context was failing between the tasks. 早些时候,当我从按钮单击事件中使用模拟上下文时,我在后台执行所有相关任务,但意识到模拟上下文在两个任务之间失败。 So once I separated the context to have it exclusively for each of the tasks, everything worked fine! 因此,一旦我将上下文分离为每个任务都专用,一切就正常了! good luck. 祝好运。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM