I have this scenario: asp.net application running as azure webrole, 2 small instances. Sometimes when the vm's are restarting, one of my instances returns 500 error, I have to manually restart each instance and hope for the best. How can I check in the onstart method of the webrole.cs that instance is up and running and if something is wrong to recycle the role ?
Asked
Active
Viewed 194 times
0
-
1when you have 2 instances only 1 instance will restart/recycle at any given time and azure will manage the availability of your web application. my guess is that there is some issue in the code that causes this error. – Aravind Mar 11 '14 at 12:00
-
Do you really want to restart the instance just because some HTTP handler failed and returned HTTP 500? – sharptooth Mar 11 '14 at 13:20
1 Answers
0
Instead of putting a Band-Aid over the symptom I would recommend solving the root cause. See http://blogs.msdn.com/b/kwill/archive/2013/09/19/troubleshooting-scenario-5-internal-server-error-500-in-webrole.aspx for techniques on how to troubleshoot 500 errors in Webroles.
If you really do want to implement this Band-Aid code then you can adapt the code from Azure Autoscale Restarts Running Instances and call RequestRecycle for a 500 response.