Created
January 11, 2013 08:22
-
-
Save martinnormark/4508906 to your computer and use it in GitHub Desktop.
Handle Azure Web Role restarts gracefully, by waiting for current requests to complete.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public override void OnStop() | |
{ | |
Trace.TraceInformation("OnStop called from WebRole"); | |
var rcCounter = new PerformanceCounter("ASP.NET", "Requests Current", ""); | |
while (rcCounter.NextValue() > 0) | |
{ | |
Trace.TraceInformation("ASP.NET Requests Current = " + rcCounter.NextValue().ToString()); | |
System.Threading.Thread.Sleep(1000); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment