A crude hack that may work. I have not tested it though
Create a file say Lock
. Lets say its in the c:\test
directory
class Program
{
static void Main(string[] args)
{
try{
File.OpenOrCreate(@"c:\test\lock", FileMode.Open, FileAccess.Read, FileShare.None);
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);
}
catch(Exception e)
{
//you can check if there is file if already open message
return;
}
}
}