TerminateFilter is not called by IIS. I have confirmed with the debugger and with print statements that the C function in pyISAPI.cpp is not called. The function is exported in the DLL.