Login

Application pool crashes when scheduled jobs are run

Versions: 4.61, FAQ number: 169, Old FAQ number: 169

The application pool crashes when I run scheduled jobs

This situation arises when using EPiServer in a .NET 2.0 environment. The default policy for unhandled exceptions was changed in version 2.0.

Earlier, unhandled exceptions on managed threads were passed up the chain of events to be handled at a higher tier. As of version 2.0 this is no longer true and as a result the process within wich the exception occurs is now stopped. 

In EpiServer, scheduled jobs are run in separate threads and are thereby affected by the changes made to the .NET framework. When the scheduled job throws an exception, the w3wp process is stopped. These stops might be numerable when using the scheduler due to changes made in the tblScheduledItemLog table (see Database timeouts and high CPU load on the database server after upgrading to 4.61 for more information on this topic).

Microsoft is aware of this issue and has posted an article concerning these changes to the exception handling policy at Microsoft.com. Follow this link to read more:

» http://support.microsoft.com/?id=911816

To work around this problem, change the unhandled exception policy back to the default behavior of previous .NET framework versions.

Add the following code to the Aspnet.config file located in

%WINDIR%\Microsoft.NET\Framework\v2.0.50727


<configuration>
    <runtime>
        <legacyUnhandledExceptionPolicy enabled="true" />
    </runtime>
</configuration>


For developers designing their own scheduled jobs it is important to remember to deal with exceptions where they occur to avoid crashing the application pool.

EPiTrace logger