Web: restart web app after unhandled exception at Windows Server

I read this topic “restart web app after unhandled exception” for macOS here:

I need the same, but for a Windows Server. Is there a possibility to automatically restart the windows web app, when it crashs?
At the moment I start the app again each night at 1am with the task scheduler.

EDIT: I’m using Windows Server 2012 and compile the Xojo Web App to an .exe at port 80.

In the Task Scheduler, in the task property Settings tab there is a control for this. `If the task fails, restart every: xxx etc

Yes, I know this setting. But this is only until the web app starts.

I have the problem, when the web app crashed and the .exe doesn’t run anymore, I want to restart it immediately again.

One thing you could do is to write an app which runs the web app and then uses a timer to regularly check it is still running, and perform checks and re run it if it fails.

Such an app could be done as a Desktop app, if you want a UI, as a Console app for no-UI or a Service app if you want it as per Cosnsole, but able to handle the proper UI service control events.

If you are running your web app as a window service there are options to automatically restart the service when it crashes, look at the sc command.

You should also look at why the service is crashing.