Windows Workflow 4.0 服务参考未显示在工具箱中

发布于 2024-12-13 08:44:23 字数 215 浏览 0 评论 0原文

我创建了一个简单的工作流服务应用程序 (WF1),然后将一个 Windows 窗体客户端添加到我的解决方案中,其中包含另一个工作流活动 (WF2)。然后我向 WF1 添加了正确的服务引用。 当我尝试使用我的服务引用添加从 WF2(Windows 表单)到 WF1(工作流服务应用程序)的消息调用时...工具箱中没有任何代表我的服务引用 WF1 的项目!它不见了。尝试添加它没有运气......我迷路了。有什么想法吗?

I've created a simple workflow service app (WF1), then I've added a windows form client to my solution with another workflow activity (WF2) within. Then I've added the proper service reference to WF1.
When I try to use my service reference to add a message call from WF2 (windows forms) to WF1 (workflow service app)... there insn't any items in the toolbox that represents my service ref WF1! It is missing. No luck trying to add it... I'm lost. Any ideas?

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

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

发布评论

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

评论(1

流星番茄 2024-12-20 08:44:23

观看视频并根据上面的第二条评论,我认为没有必要尝试使用 WorkflowService 作为其他工作流程中的活动,就像视频所示的那样。请注意,在视频中,他只是拨打了其中一个服务部门的电话。工作流控制台模板项目允许通过将操作包装在活动中来以这种简单的方式调用服务操作,从而使您不必实例化代理客户端。还有其他方法可以达到相同的结果。

我会做什么:将 WinForms 客户端中的服务引用添加到 WorkflowServiceApp、WF1(您已经完成了此操作)。在第二个工作流 (WF2) 中,实例化 WF1 类型的代理并直接调用服务公开的操作,就像您不在工作流中时调用任何正常的服务操作一样。它基本上使用 WCF 服务。一种选择是创建服务类型的变量,在分配活动等中实例化新引用,创建服务结果类型的变量,最后调用服务,或者在其他分配或 InvokeMethod 活动中。

第一个分配活动:

proxy = New WF1Client() //That has to be the name of you client as created by the Service Reference

第二个分配活动:

Result = proxy.MyMethod(...) //The call to the operation. You would have to create the variables to hold the result and any input parameters you wish to pass to the operation.

这很简单。您不需要将服务本身用作活动。

如果您仍然需要将其作为一个活动在设计器内部使用或在其他工作流程之间共享,请创建一个 代码活动,调用其中的服务操作(实例化代理、设置输入等),编译,您的代码活动将出现在工具箱中,以便您可以在 WF2 中使用它。此外,如果您创建一个 ClassLibrary,并实现您的活动,无论是 WF 附带的活动还是自定义活动在那里,您可以通过引用 ClassLibrary 在不同的工作流项目中重复使用它们。如果您可以控制 WF1 的开发,您可以使用此方法来重用您的活动。

希望这有帮助。

After watching the video and based on your second comment above, I believe that it is not necessary to try to use the WorkflowService as an activity inside other workflow, the same way the video shows. Realize that, in the video, he is only making a call to one of the service operations. The Workflow console template project allows calling the service operation in that easy way by wrapping the operation in an Activity, thus freeing you from having to instantiate a proxy client. There are other ways to achieve the same result.

What I would do: Add the Service Reference in your WinForms client to the WorkflowServiceApp, WF1 (you’ve already done this). Inside the second workflow (WF2), instantiate a proxy of the type of WF1 and call the operations the service exposes directly, like you would call any normal service operation if you were not inside a workflow. It is basically consuming a WCF service. One option will be to create a variable of the type of your service, instantiate a new reference in, for example, an Assign activity, creating a variable of the type of the result of the service and finally making a call to the service, either in other Assign or InvokeMethod activity.

First Assign activity:

proxy = New WF1Client() //That has to be the name of you client as created by the Service Reference

Second Assign activity:

Result = proxy.MyMethod(...) //The call to the operation. You would have to create the variables to hold the result and any input parameters you wish to pass to the operation.

That would be straight forward. You won't need to use the service itself as an Activity.

If still you need to make it one single activity to use inside the designer or share between other workflows, create a Code Activity, make the call to the service operation in it (instantiate proxy, set inputs, etc.), compile and your code activity will appear in the toolbox so you can use it in WF2. Furthermore, if you create a ClassLibrary, and implement your activities, either the ones that come with WF or custom activities there, you can re-use them in different workflow projects by referencing the ClassLibrary. If you have control over the development of WF1 you could use this approach to re-use your activities.

Hope this helps.

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