Windows服务应用程序体系结构的疑虑

Windows服务应用程序体系结构的疑虑

本文介绍了Windows服务应用程序体系结构的疑虑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我需要创建一些的 Windows服务应用程序(C#)应执行多个定期执行,并绑定到对方的任务,如:

So I am wandering if I can just use "quickly and dirty" approach and implement all this using BackgroundWorker class or I have use more sophisticated stuff like Tasks y etc (.NET Windows Service - Architectural Decisions). Or event there are some frameworks to do it.

Any advice about possible modern and clean structure of that application would be nice to hear. Thank you very much!

解决方案

Sounds like you'll be needing this on a dedicated server. So my first suggestion is to use TopShelf. It makes putting together modern Windows services so easy its laughable.

Then to perform the steps in your question I'd use some sort of workflow pattern. Windows Workflow Foundation seems to be modern enough to cater for this. (Personally, I just use the chain-of-responsibility pattern with a DI container as my quick and "dirty").

Lastly combining that with an event-driven approach that kicks off the workflow, like FileSystemWatcher, you won't even need to worry about backgroundworkers etc.

So with those architecture decisions made, your service will be easy to setup, run, test and install (TopShelf), and you can build and unit test your service modularly (workflow pattern).

这篇关于Windows服务应用程序体系结构的疑虑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 16:48