0

I'm having problems with an ASP.NET WebForms application, throwing 'System.InvalidOperationException', causing the site to crash (and restarting the application pool temporarily "solves" the issue).

In my development environment I have never seen this occur and therefore I'm having a very hard time finding the source of the problem.

How can I save some kind of dump of what a user clicked to cause this problem?

Is there a way for me to catch all exceptions, or just exceptions of InvalidOperation-type, and save them to a file, then restart the application pool programmatically? (this way I can have a "fix" while finding the cause of the error..)

Thanks in advance

EDIT

I got ELMAH working, it wasn't that hard really! I was able to catch the error and all preceeding errors. It seems the server wasn't able to serve pages fast enough, wich caused time outs, which somehow causes locks on some read/write thingy within LINQ to SQL (using SubSonic ActiveRecord) to stay locked (it sets an "_invalid"-flag to true while using the object.

The next time something tries to use the object it's already locked and the invalidoperationexception is thrown...

Niclas Lindqvist
  • 1,412
  • 2
  • 17
  • 24

1 Answers1

1

I think ELMAH would do what you want. We use it heavily in our applications, including in production.

Colin Pickard
  • 45,724
  • 13
  • 98
  • 148
  • Thanks, I've heard of it, but never really known how to go about implementing it. I'll look in to it! Do you have any idea on how to restart an application pool programmatically if an error occurs? – Niclas Lindqvist Apr 13 '12 at 09:26
  • I got ELMAH working, it wasn't that hard really! Still no idea why it occurs really, but I was able to catch it and preceding errors! – Niclas Lindqvist Apr 16 '12 at 15:42