Workflow Foundation 线程和 WCF OperationContext

发布于 2024-07-13 17:25:54 字数 521 浏览 3 评论 0原文

我正在使用 WorkFlowServiceHost(在 .net 3.5 中)来托管状态机工作流。 我使用 WCF 接收活动来处理对工作流的调用。 我正在使用 WCF 授权策略根据消息标头中的信息将声明附加到传入请求。 因此,在链的下游,我可以使用 ServiceSecurityContext 或仅使用 Thread.CurrentPrincipal 来获取有关请求的授权信息(角色、用户等)。

我知道这对我们不起作用,因为工作流程正在分派不同的线程来处理运行时引擎在有工作要做时引发的事件(即接收活动)。 有关请求 (OperationContext) 的上下文信息在工作流程中不再可用(除非在运行时线程上执行工作时随机提供)。

我想要做的是在创建工作线程之前获取有关请求(OperationContext)的信息,获取工作线程并将上下文信息附加到它,以便它在工作流实例中可用。

我想运行时一定有一些事件我可以处理来做到这一点,但我没有想出任何东西。 而且我真的不想使用手动工作流程调度程序。 任何帮助表示赞赏。

谢谢!

I am using the WorkFlowServiceHost(in .net 3.5) to host a State Machine Workflow. I use the WCF receive activities to handle calls into the workflow. I am using a WCF authorization policy to attach claims to the incoming requests based on info in the message headers. So, further down the chain I can use the ServiceSecurityContext or just the Thread.CurrentPrincipal to get authorization info about the request(roles, user, etc).

I know this will not work for us because the workflow is dispatching different threads to handle the events that the runtime engine raises when there is work to do(ie. the receiveactivity). The contextual info about the request(OperationContext) is no longer available within the workflow(except randomly when the work is executed on the runtime thread).

What I would like to do is get the info about the request(OperationContext) before the worker thread is created, get the worker thread and attach the contextual info to it so it is available within the workflow instance.

I am thinking there must be some event on the runtime I can handle to do this but I am not coming up with anything. And I really don't want to use the manual workflow scheduler. Any help is appreciated.

Thanks!

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

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

发布评论

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

评论(1

情释 2024-07-20 17:25:54

我对此已经很晚了,但我在谷歌上搜索“silverlight operationcontext”并找到了你的SO问题以及我链接的博客文章(在 Google 结果中一篇紧接着一篇)。 我不知道这是否有帮助(他说,大约两年后)。

我没有太多使用 WCF 的工作,也没有使用 WFF 的工作,所以除了这个链接之外我没有什么要补充的。

I'm pretty late with this, but I was googling "silverlight operationcontext" and found your SO question as well as the blog post that I am linking (one right after the other in the Google results). I don't know if it will help or not (he says, almost two years later).

I haven't worked much with WCF and not at all with WFF, so I don't really have much to add aside from this link.

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