asp.net-mvciisrequest-pipeline

SQL Exception breaks IIS request pipeline


I have MVC3 app that is making IIS go crazy. And me too.

If SQLException happens (ie stored procedure is missing) request pipeline breaks, user sees "Sorry, an error occurred while processing your request", nothing is logged in event viewer. Request tracing gives absolutely no useful info but you can take a look here. Interesting part is on line 6448 where error code is "The operation completed successfully".

Now here is the fun part:

UPDATE: this problem is not limited to SQLException. ANY Exception ie throw new Exception("Bla") will break pipeline as described above.


Solution

  • I think that is because you probably have the attribute [HandleError] somewhere in your controllers.This attribute always catches uncaught exceptions and displays the default Error.cshtm view which can be found in your shared folder.

    For more info see this related answer.

    Regards.