简体   繁体   中英

Calling .NET webservice automatically

I am new to .NET and web services. My aim is to create a .asmx webservice in C# which will invoke itself in every 12 hours automatically. So, there won't be anybody invoking its methods but it will invoke itself regularly. I am confused about how to do this with .NET webservices.

My suggestion would be to use either a windows service or a console app scheduled to run every 12 hours by the host system's scheduling software (Windows Task Scheduler, cron, etc.).

Here is an interesting discussion on the similar requirement like yours to run a method at regular intervals and David has given various options in there.

如果它是公共Web服务(或在任何情况下都可以在Internet上使用),则可以签出新的Azure Scheduler来定期调用您的Web服务。

您可以创建Windows服务和设置程序,每隔12小时致电一次,您可以轻松找到如何创建和设置Windows服务的程序

You can Create and schedule Jobs that will invoke every 12 Hours or say at 12am and 12pm everyday using Quartz.NET

You can create your Cron expression using :

"InitializeScheduler()" calls the job where JobType => typeof(YourClass) with Execute() holding the required method to execute. And cron expression will identify and schedule its time

Please follow the links for further understanding on the implementation :

http://www.quartz-scheduler.net/

http://geekswithblogs.net/TarunArora/archive/2012/11/17/quartz.net-writing-your-first-hello-world-job.aspx

http://simplequartzschedulerincsharp.blogspot.in/

Works best for my requirements

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM