我们可以将工作流服务托管为 Windows 服务吗?
我正在开发一个日志记录应用程序,它要求我有一个作为服务公开的工作流(工作流服务)。我们希望将其托管为 Windows 服务(不希望将工作流服务托管为 IIS 中的 .svc 文件)。将其作为 Windows 服务的另一个原因是能够通过命名管道与服务进行通信。
我们可以通过命名管道公开工作流服务而不将其托管在 IIS 中吗?
I am working on a logging application that requires me to have a Workflow that is exposed as a Service (Workflow Service). We want to host it as a Windows Service (don't want to host workflow service as .svc file in IIS). Another reason for having it as windows service is to be able to communicate with the service through the Named pipes.
Can we expose a Workflow Service through Named Pipes without hosting it in IIS?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,你当然可以。至少,我在 Workflow 4 Release Candidate 中取得了同样多的成就。
考虑一下,
我相信端点配置可以通过 App.config 中的标准 Wcf 服务配置部分进行设置。在我的工作流实验中,我个人并未尝试更改默认传输层。
上面代表了一个通用的纯托管类[即它自托管WorkflowServices]。这使我们能够在控制台、WinForm、WPF 甚至 WindowsService 应用程序中重复使用此托管功能。下面是一个利用我们的主机类的 WindowsService
如果您在 VS2010RC 中摆弄过 WorkflowServices,那么您可能已经知道 WorkflowServices 不像它们的 Workflow 表亲那样是一流的 Xaml 类。相反,它们被保存为带有 .xamlx 扩展名的松散 Xaml 文件。 [据我所知] WorkflowServices 没有设计时智能感知支持,并且不被识别为声明类型,因此我们在运行时加载 WorkflowService 的唯一选择是
无论哪种方式,我们都必须解释标记并创建 WorkflowService 定义。以下代码会将字符串 [可能是文件名或标记] 转换为 WorkflowService。热衷者可能还注意到,此过程与将工作流标记转换为工作流定义的过程之间存在差异。
Yep bep, you sure can. At least, I have accomplished as much with Workflow 4 Release Candidate.
Consider,
I believe endpoint configuration may be set via standard Wcf service configuration sections in App.config. I have not personally attempted a change to default transport layer in my experiments with Workflow.
The above represents a generic pure hosting class [ie it self-hosts WorkflowServices]. This allows us to re-use this hosting functionality within a console, WinForm, WPF, or yes, even a WindowsService application. Below is a WindowsService that leverages our host class
If you have fiddled with WorkflowServices in VS2010RC, then you may already know that WorkflowServices are not first class Xaml classes like their Workflow cousins. Instead, they are saved as loose Xaml files with the .xamlx extension. There is no design-time intellisense support for WorkflowServices [as far as I know] and are not recognized as declared types, so our only options to load a WorkflowService at run-time are
Either way, we must interpret markup and create a WorkflowService definition. The following will transform a string [that may be a filename or markup] into a WorkflowService. Keeners may also note that there is a difference between this process and the process for transforming Workflow markup to Workflow definitions.
是的,这是可能的。您必须创建自己的服务。请参阅 MSDN 上的托管和使用 WCF 服务,尤其是 部分在 Windows 服务中托管。
Yes it is possible. You will have to create your own service. See Hosting and Consuming WCF Services on MSDN, especially the section Hosting in Windows Services.