How to call an ASP.NET Core Web API every minute. It has to process data every minute (Call another API). Windows service and scheduler?
Asked
Active
Viewed 507 times
-3
-
It's not clear to me what exactly you're asking. Yes, you can build another process which invokes a web request at periodic intervals. Is anything stopping you from doing that? This has nothing to do with the Web API technology and more to do with whatever you're using to invoke it. It may not even be the best approach for what you're trying to accomplish, but we don't really know what you're trying to accomplish so there isn't much advice to offer on that. Either way, please clarify the specific problem you're having. – David Sep 25 '18 at 16:22
-
Did the same with windows service. – Linoy Sep 25 '18 at 16:25
-
I am trying to sync data between two systems (One is website with sql DB and the othersystem is in Azure). So if any insert/updates from Website to DB then I need to trigger a WebAPI(tobe developed) that will call the Azure System Web API. And also if any updates from the Azure System then they can call my WebAPI (tobe developed) and post the data. My question is how to monitor the insert/Update and call the WebAPI? Hope this is clear. 1) Website => DB => WebAPI => Azure System API 2) Azure System API => WebAPI => DB – dock5678 Sep 25 '18 at 16:29
-
@LMK If I do with windows service do I need to call the service by Scheduler? – dock5678 Sep 25 '18 at 16:31
1 Answers
0
So you have to sync SQL and azure. For example, if you create a new table that holds inserted/updated table info and some flag(say, status=1 meaning, not yet processed) then write a window service that checks new table each 1 min for change(looking for entries with status as 1), if you found any, call your api to update the azure and finally update the table with status as 2(meaning entries processed)
Install your windows service in needed system and which will automatically invoke your method. Means, no need of separate scheduler. Install a Windows service using a Windows command prompt?
Hope this will give you some idea

Linoy
- 1,363
- 1
- 14
- 29