WaitHandleCannotBeOpenedException on Azure web role start with Task.Wait()
问题 The following (web) role entry point, after returning, causes the below exception to be thrown. public class WebRole : RoleEntryPoint { public override bool OnStart() { Task.Run(() => { // Anything can be here, but the lamdbda can be empty too... }).Wait(); return true; } } The exception: A first chance exception of type 'System.Threading.WaitHandleCannotBeOpenedException' occurred in mscorlib.dll Additional information: No handle of the given name exists. As apparent this is thrown from the