I am writing a C# console application which calls a web service to pull a huge volume of data from database (time consuming process) and windows task scheduler will execute this console application at a scheduled time. Now, many task schedulers (for example at least 70 task schedulers) will be created to execute the same exe at the same time. What would be the best way to design such application so that this exe will not be interrupted while one task scheduler is executing and other task scheduler is trying to execute the same exe at the same time?
A sample program is given below
class Program
{
static void Main(string[] args)
{
var countryCode = "34";
WebServiceClient client = new WebServiceClient(); //ASP.NET web service
var output = client.Process(countryCode);//this is a time consuming process and takes 5 minutes or more
File.WriteAllText("c:\\test\\country.txt", output);
}
}