/// <summary> /// Static constructor. Build the function pointers /// </summary> static IisEntryPoint() { HardReference <Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener>(); // Try never to let an exception escape AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; AppDomain.CurrentDomain.FirstChanceException += CurrentDomain_FirstChanceException; // you can add this to get insight into the hosted sites ShutdownPtr = ShutdownCallback; // get permanent function pointer GcShutdownDelegateHandle = GCHandle.Alloc(ShutdownPtr); // prevent garbage collection WakeupPtr = WakeupCallback; GcWakeupDelegateHandle = GCHandle.Alloc(WakeupPtr); HandlePtr = HandleHttpRequestCallback; GcHandleRequestDelegateHandle = GCHandle.Alloc(HandlePtr); }