0

In my asp.net web app, I want to run a sql call everyday at a certain time. I understand that I cant do this in a controller because the life cycle of controllers are request based.

Can anybody point me in the right direction for how to setup a "Logic App" on my server side?

  • 1
    [Similar question](https://stackoverflow.com/questions/61372133/how-to-run-cron-job-every-day-in-asp-net-core-application) and also an [article](https://codeburst.io/schedule-cron-jobs-using-hostedservice-in-asp-net-core-e17c47ba06) about cron jobs and HostedServices – Sergey Sosunov Aug 26 '22 at 18:28
  • 1
    It'll depend on what server you use and what services are available. On a Windows Server for example you could potentially have a Windows Service. On just about any server there's likely to be some kind of task scheduler (which may or may not be available for any given 3rd party host) which could be used to schedule a Console App. In Azure you have Azure Functions. Etc. The point is, this would be a separate application from your web application. – David Aug 26 '22 at 18:36
  • @David We currently use Azure Logic apps but were trying to step away from them as we seem to always have problems with them. – OutsideToday Aug 26 '22 at 18:40
  • Hi @OutsideToday, As Sergey Sosunov said, did you consider using Background tasks with hosted services? Reference: [How to create Background tasks with hosted services in asp.net core](https://learn.microsoft.com/en-us/aspnet/core/fundamentals/host/hosted-services?view=aspnetcore-6.0&tabs=visual-studio). – Rena Aug 29 '22 at 08:04

1 Answers1

0

it does not need to be a web application, just a console app as a job would be fine, inside the app you can use hangfire of quartz to handle your job to be run at the specific time you want.

Reza
  • 51
  • 1
  • 3