I am working on a .NET project that I publish on Microsoft Azure. When I publish the app, I see some termination in log files. In particular, the first one is:
Application 'D:\home\site\wwwroot\' was recycled after detecting app_offline.htm.
I have no app_offline.htm
in my directory in Visual Studio.
So I am publishing the application, and it immediately terminates, hence stops working.
How do I fix this?
CodePudding user response:
The App Offline file (app_offline.htm
) is used by the ASP .NET Core Module to shut down an app.
If a file with the name app_offline.htm
is detected in the root directory of an app, the ASP .NET Core Module attempts to gracefully shut down the app and stop processing incoming requests. If the app is still running after the number of seconds defined in shutdownTimeLimit
, the ASP .NET Core Module stops the running process.
While the app_offline.htm
file is present, the ASP .NET Core Module responds to requests by sending back the contents of the app_offline.htm
file. The app_offline.htm
must be less than 4 GB. When the app_offline.htm
file is removed, the next request starts the app.
When using the out-of-process hosting model, the app might not shut down immediately if there's an open connection. For example, a WebSocket connection may delay app shut down.
This is causing the app_offline.htm
file to be created. Set the EnableMsDeployAppOffline
value to false
if you don't want to take the app offline when publishing.
Also, taken from Visual Studio publish profiles (.pubxml) for ASP.NET Core app deployment - Compute project items.
When an ASP.NET Core project references
Microsoft.NET.Sdk.Web
in the project file, an app_offline.htm file is placed at the root of the web app directory. When the file is present, the ASP.NET Core Module gracefully shuts down the app and serves the app_offline.htm file during the deployment.