带计时器的网络服务 [英] web service with timer

查看:98
本文介绍了带计时器的网络服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建将在互联网上发布的网络服务

但我需要每隔5分钟执行一次内部的代码,所以我想添加计时器来重复代码执行但是我怎么样在web服务中添加计时器或者有另一种解决方案

需要帮助

谢谢

i want to create web service that 'll be published on internet
but i need the code inside it to be executed every 5 minutes so i think to add timer to repeat code executing but how i add timer inside web service or there's another solution
need for help
thanks

推荐答案

你好,



网络服务不是做计时器的好地方。如果每隔5分钟就有工作要做,那么网络服务很适合阅读该工作的结果或进度,但不是一个好的工作主持人。



你的最好的选择是使用服务(更陡峭的学习曲线)或简单的控制台应用程序(最简单)。控制台应用程序可以放入Windows任务计划程序,每隔x分钟调用一次即可完成工作。



这种方法可能会使用数据存储(例如作为SQL服务器)您将把结果放在哪里。网络服务将从这些结果中读取。



希望这可以帮助您朝着正确的方向前进。



干杯。
Hi there,

The web service isn't a good place to do a timer. If there's work to do every 5 minutes, the web service is good to read the result or progress of that work, but not a good host for the work.

Your best bet is to go with a service (steeper learning curve) or a simple console app (easiest). The console app could be put into Windows Task Scheduler and called every x minutes to do its work.

The approach there would be that you would use a data store (such as SQL server) where you would put your results. The web service would read from those results.

Hope this helps you get moving in the right direction.

Cheers.


提供了很好的解决方案。谢谢......
so nice solution offered .thanks ...


这篇关于带计时器的网络服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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