如何实现在一定时间间隔后轮询或检查数据库的WCF服务 [英] How to implement WCF Service which does polling or checking database after a certain time interval

查看:170
本文介绍了如何实现在一定时间间隔后轮询或检查数据库的WCF服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

I have a requirement where I want to implement a WCF Service which checks a status from a Database column after a certain time interval lets say 20 minuets, if this status is true I want to execute some operation else some other operation. So is it possible to implement the desired functionality using WCF Service, If yes please guide me how should I implement, As I have no idea how to do it.

If its is not possible, then please suggest me some good options like (Web Services, windows service etc.). Please provide me sample code or some good links where I can find the way to approach this problem. I want this service to run on my PC always and check status after 10-20 minuets. I am more comfortable with C#, So If it could be done in C# its well and good. Otherwise also not an issue. I have windows PC

推荐答案

你使用了错误的方法。 Web服务用于按需使用,而窗口服务和计划任务应用于定期活动。将必要的代码从Web服务移动到DLL中,然后使用Timer创建Windows服务,或者您可以使用通过计划任务计划的控制台应用程序。
You're using the wrong approach. Web Services are meant for on-demand use, while window services and scheduled tasks should be used for periodic activities. Move the necessary code out of the web service into a DLL and then either create a Windows Service with a Timer or you can use a console app that is scheduled through Scheduled Tasks.


这篇关于如何实现在一定时间间隔后轮询或检查数据库的WCF服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆