I have several ASP.NET Core websites on a Windows Server 2016 VM running in IIS/Kestrel (reverse proxy configuration).
Some of these websites have some inactivity time during the day. Because of that, their Application Pool is terminated (and I would like to keep that to use fewer resources). The problem is that cold-start was taking a quite long time. I then setup these app pools to Suspend
instead of Terminate
after idling out.
Since then, these websites are not only taking longer to start when cold, but also have been giving out 503s in some of the cold starts. Once they're started, they work normally. But the first hit on a suspended app pool is almost always a 503. The body contains a message like "The service is unavailable", but translated (and not in UTF-8, it seems, since characters are not correctly rendered). I'm not sure if this message is coming from IIS or Kestrel.
After looking for Failed Request Traces, I found this:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="WWW Server" Guid="{3A2A4E84-4C21-4981-AE10-3FDA0D9B0F83}"/>
<EventID>0</EventID>
<Version>1</Version>
<Level>3</Level>
<Opcode>16</Opcode>
<Keywords>0x100</Keywords>
<TimeCreated SystemTime="2019-10-24T15:13:51.803Z"/>
<Correlation ActivityID="{80000C51-0003-BC00-B63F-84710C7967BB}"/>
<Execution ProcessID="13656" ThreadID="17072"/>
<Computer>[REDACTED]</Computer>
</System>
<EventData>
<Data Name="ContextId">{80000C51-0003-BC00-B63F-84710C7967BB}</Data>
<Data Name="ModuleName">AspNetCoreModuleV2</Data>
<Data Name="Notification">128</Data>
<Data Name="HttpStatus">503</Data>
<Data Name="HttpReason">Server has been shutdown</Data>
<Data Name="HttpSubStatus">0</Data>
<Data Name="ErrorCode">2147943515</Data>
<Data Name="ConfigExceptionInfo"></Data>
</EventData>
<RenderingInfo Culture="en-US">
<Opcode>MODULE_SET_RESPONSE_ERROR_STATUS</Opcode>
<Keywords>
<Keyword>RequestNotifications</Keyword>
</Keywords>
<freb:Description Data="Notification">EXECUTE_REQUEST_HANDLER</freb:Description>
<freb:Description Data="ErrorCode">A system shutdown is in progress.
(0x8007045b)</freb:Description>
</RenderingInfo>
<ExtendedTracingInfo xmlns="http://schemas.microsoft.com/win/2004/08/events/trace">
<EventGuid>{002E91E3-E7AE-44AB-8E07-99230FFA6ADE}</EventGuid>
</ExtendedTracingInfo>
</Event>
User contributions licensed under CC BY-SA 3.0