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.