Windows Workflow 4.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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
观看视频并根据上面的第二条评论,我认为没有必要尝试使用 WorkflowService 作为其他工作流程中的活动,就像视频所示的那样。请注意,在视频中,他只是拨打了其中一个服务部门的电话。工作流控制台模板项目允许通过将操作包装在活动中来以这种简单的方式调用服务操作,从而使您不必实例化代理客户端。还有其他方法可以达到相同的结果。
我会做什么:将 WinForms 客户端中的服务引用添加到 WorkflowServiceApp、WF1(您已经完成了此操作)。在第二个工作流 (WF2) 中,实例化 WF1 类型的代理并直接调用服务公开的操作,就像您不在工作流中时调用任何正常的服务操作一样。它基本上使用 WCF 服务。一种选择是创建服务类型的变量,在分配活动等中实例化新引用,创建服务结果类型的变量,最后调用服务,或者在其他分配或 InvokeMethod 活动中。
第一个分配活动:
第二个分配活动:
这很简单。您不需要将服务本身用作活动。
如果您仍然需要将其作为一个活动在设计器内部使用或在其他工作流程之间共享,请创建一个 代码活动,调用其中的服务操作(实例化代理、设置输入等),编译,您的代码活动将出现在工具箱中,以便您可以在 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:
Second Assign activity:
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.