Reputation: 396
I am deploying my web role application on azure cloud. There is a small code block that needs to be executed in separate thread. My code block is as follows:
private static bool Method1()
{
...
...
System.Threading.Thread thread = new System.Threading.Thread(() => Method2());
thread.Start();
...
...
}
private static void Method2()
{
....
....
}
I have tested this code in my local system. it is working fine. To check what is happening exactly, I placed code to write in log file. On Azure cloud service Method1() executes without any error. Even code block executed successfully before and after defining and starting thread. but Method2() is never executed.
Is threading not allowed on azure cloud service? Or implementation of threading is different for azure cloud service?
Thank You...
Upvotes: 0
Views: 614
Reputation: 382
It's very hard to tell from your description. Threading is allowed. One thing to consider is that timing will be different between your machine and the Azure VM.
One possible cause I can think about is process termination before the thread got a chance to be scheduled to run - an exception that kills your application or the main thread exits.
Upvotes: 1