In IIS when you have a FastCGI process, signal the process before it recycles

Robert van Geel 0 Reputation points
2024-03-11T16:53:49.79+00:00

Currently, when IIS recycles a fastcgi process, this process is not notified beforehand. The result is that there's no clean way to flush logs, commit transactions or do other finalizations.

Proposed solution:

  • in web.config allow for a URL handler that is called before teardown eg teardownhandler=/teardown teardowngracetime=3
  • then, before the application is terminated, IIS should FIRST call this handler (which is just a GET request) so the program can 'know' to start closing down. The timeout for the process to be killed in this example is 3 seconds but could be more, or less, depending on the setting, so in this case the application has 3 seconds to do whatever it needs to do to gracefully exit
  • this mechanism should only work when the setting has a value, when not set, it does not need a signal-call. This ensures that there is no chance any existing application or setup is affected

I think this would greatly contribute to the 'elegance' of the solution.

Internet Information Services
{count} votes

1 answer

Sort by: Most helpful
  1. Robert van Geel 0 Reputation points
    2024-03-14T23:27:48.0966667+00:00

    I have managed to get my app running using httpplatformhandler.

    However, it has the same limitation as fastcgi: the handler application is not notified before it's tore down.

    For that reason, my original suggestion for functionality still applies, albeit for httpplatformhandler scenario's.