When replacing an IIS error handler I suggest to use a standard HTML page, hand written or creaed with the scheduler. So this page cant cause any recursion.
Turn off EPiServers error handler
EPiServer.config
<episerver...>
<sites>
<site...>
<siteSettings
...
globalErrorHandling="Off"
web.config
<configuration>
<system.web>
<customErrors defaultRedirect="MyErrorPage.htm"
mode="RemoteOnly">
</customErrors>
Remarks
Wildcard module mappings can disturb this handling, and have fallback to EPiServer standard error handling.
More concrete:
If you get EPiServer standard error page even when you had it disabled. Look in the modules section in the IIS manager then it can exists a wildcard (*) mapping module that responds with EPiServer standard error.