问题
I am running an ASP .Net Web API 2 application in an Azure Web App Service.
Many times a day (5-6 times), the Web Service restarts without any earlier notice or error message. I scaled to two instances (always, does not depend on load) and both get restarted simultaneously.
I did set the "Always-On" (keep-alive) setting and I can see successful requests being performed a few seconds or minutes before the Web Service restarts.
When it does restart it always restarts twice, the second time I get the following error in the logs (same error appears a few times, every 10sec):
Could not send heartbeat. Access to the path
'C:\DWASFiles\Sites\#1mysite\VirtualDirectory0\data\DaaS\Heartbeats\RD000F3D11DC6C'
is denied.
This error message is sometimes followed by the following:
Terminating RD000F3D10A5B7. 1/15/2016 6:16:45 AM vs (now) 1/15/2016 6:38:08 AM
Couldn't delete exception RD000F3D10A5B7. One or more errors occurred.
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)"
at DaaS.HeartBeats.HeartBeat.Delete()
Terminating RD000F3D11DC6C. 1/15/2016 6:16:38 AM vs (now) 1/15/2016 6:38:08 AM
Couldn't delete exception RD000F3D11DC6C. One or more errors occurred.
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)"
at DaaS.HeartBeats.HeartBeat.Delete()
Thread was being aborted.
Which is probably the cause of the second restart.
Notice that the Could not send heartbeat
error only concerns one instance but both get restarted.
I sometimes get the Could not send heartbeat
message without having my instance restarted.
I already had this error when I scaled to only one instance.
My Web Service logs both to an SQL Database and to a Blob Storage and I cannot see any error message that explains the first restart. The error messages i produced earlier were caught by the Blob Storage. There is no message in the Event Viewer either.
Has anyone stumbled upon this issue?
来源:https://stackoverflow.com/questions/34808829/web-app-service-in-azure-restarts-many-times-a-day-without-error-in-logs