0
votes

I've created a C# console application that does some updates in a SQL server database. I've set that application in the Task Scheduler to run daily. The application is running fine, but I noticed that the task never stops but keeps showing "Running", I have to click "End" by myself to stop it.

How can I let the task stop by itself without forcing it to stop ?

2

2 Answers

2
votes

The task would stop by it self under normal conditions. What purpose does your application server? It's doing something to keep it alive, since a normal console application would just run its course and shut down.

You always have the options of just straight up murdering it at the end of it's job, but it would be a better choice to identify what is keeping it alive.

System.Environment.Exit(0);

Is it multithreaded? Do you have some backgroundworkers running or anything?

0
votes

This has been solved by using the files created in Debug instead of Release in the scheduled task, but i'm not sure why is that.