Window Service每隔5分钟调用一次wcf服务 [英] Window Service calling wcf service after every 5 minutes

查看:79
本文介绍了Window Service每隔5分钟调用一次wcf服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿伙计,



我需要你的帮助。我想实施一个C#窗口服务,每5分钟后调用一次Wcf服务。





我已经成功调用了Wcf服务,但问题是如何在Window Service C#5分钟后立即调用wcf服务。





先谢谢。



问候



Aneeq

Hey Guys,

I need ur help.I want to implement a C# window Service which will be Calling Wcf Service after each 5 mintutes.


I have successfully called Wcf service but problem is that how can i make a call to wcf service right after 5 minutes from Window Service C#.


Thanks in Advance.

Regards

Aneeq

推荐答案

参考 - 可以自动安排WCF吗? [ ^ ]。

Refer - Can WCF be auto scheduled?[^].
Quote:

不,WCF无法自动安排。您需要实施计划任务(请参阅在Windows上安排作业),这是一个带有计时器(你已经说过你不想做,如果我理解的话)或其他一些带有计时器的应用程序。

No, WCF cannot be auto-scheduled. You need to implement a Scheduled Task (see Scheduling jobs on windows), a Windows Service with a timer (which you've said you don't want to do, if I understand correctly) or some other application with a timer.

你可以按照你的方式启动一个线程另一个答案,但这取决于你的服务调用本身 - 我更喜欢从外部调用它来自另一个进程。

You could start a thread as per the other answer but this relies on your service calling itself - I'd prefer to call it externally, from another process.

计划任务可以运行可执行文件。您可以编写一个调用WCF服务的控制台应用程序,记录任何结果(如果需要)然后完成。

A scheduled task can run an executable. You could write a console application that calls your WCF service, logs any result (if necessary) and then completes.

我通常更喜欢通过Windows实现这种类型的计时器服务,只是因为Windows服务可以被监控,可以记录,并且可以自动启动/自动重启 - 安装它并且它正常工作。如果我不想使用Windows服务,那么我会安排一项任务。

I normally prefer to implement this type of timer through a Windows Service, simply because the Windows Service can be monitored, can log, and can auto-start / auto-restart - install it and it 'just works'. If I didn't want to use a Windows Service then I'd schedule a task.


这篇关于Window Service每隔5分钟调用一次wcf服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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