Call the console application in a timely manner using a scheduled Windows task. Is this a valid approach

This is about the ASP.NET MVC background. When I need to call action methods in a timely manner, I use tools of the third part, such as HangFire, which runs under the application pool. I want to create a synchronization task that reads a CSV file created by our ERP system and updates our custom database. But I know that doing this synchronization job as an action method inside my ASP.NET MVC is not the right way to do the actions, since the background jobs should not be part of my web application.

Therefore, to process my synchronization job, I did the following:

  • Using Visual studio 2012, I created a new console application and inside its main method, I wrote a synchronization task as follows: -

    class Program
    {
        static void Main(string[] args)
        {
            using (Entities sd = new Entities())
            {
                //code goes here
                sd.SaveChanges();
            }
        }
    }
    
  • How can I call this console application in a timely manner? I am thinking of creating a new task using the Windows Task Scheduler, which will run every hour and call the application, basically calls the .application file?
+4
source share
2 answers

Now my question is, how can I call this console application in a timely manner ?, I am thinking of creating a new task using the Windows Task Scheduler, which will run every hour and invoke the application, basically calls the .application file?

- , Windows (TS). , , TS.

TS:

  • , ( , )

, -:

  • Windows , .

-

/ / , ASP.NET, #, , IIS , . - , . .

IIS, , , , .

.

ASP.NET , API , .

+2

Windows - .net. , , .

+2

Source: https://habr.com/ru/post/1624028/


All Articles