1

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.

8
  • Sounds like very strange design. Why do you want it to be web service at all? Web service runs only when it is called, so with your design, it should be running 24 hours per day just to be able to call itself.. to run itself.. You must think it again. For example, you can trigger calling web service by Windows Task Scheduler. Commented Jul 2, 2014 at 10:33
  • Well I want also clients to reach it but its main duty is to update database in 12 hours. Commented Jul 2, 2014 at 10:37
  • 2
    Then create database job or windows task scheduler task. Commented Jul 2, 2014 at 10:39
  • but database will be updated by gathering some data from another website. my service will get data in 12 hours from another website and update db. Commented Jul 2, 2014 at 10:40
  • 5
    Create window service which will call web service with regarding parameter, if any, also you can define it for some time span like after 5 min or 12 hour your service will call and do the required operation. i did such so many time Commented Jul 2, 2014 at 10:50

4 Answers 4

1

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.

Sign up to request clarification or add additional context in comments.

Comments

1

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 :

http://www.cronmaker.com/

"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

Comments

1

If it's a public webservice (or one available on the Internet, in any case) you can check out the new Azure Scheduler to invoke your webservice on a regular basis.

Comments

0

You Can create windows service and setup to call after every 12 hours you can easily find how to create and setup windows service

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.