MiscellaneousUser
MiscellaneousUser

Reputation: 3053

IIS Notification on 500 Error

I have a WCF service that receives XML messages from an external source. If the XML is invalid, it throws a 500 Internal Server Error. The client receives the error but on our side, we're oblivious to it happening. How can I update the service or IIS so that if an invalid XML format has been received, our service notifies us that it has happened and what XML has been received and threw the error. The client doesn't treat our service as a service though, they use HTTPRequest to post to our service.

Upvotes: 2

Views: 825

Answers (1)

Peter Hahndorf
Peter Hahndorf

Reputation: 11222

There is no builtin way to send an email when a 500 happens.

But you have several options:

  • Make the 500 error page a dynamic asp.net page which sends the email. I don't like it because if your app is seriously broken, the error page may not work either.

  • Have a PowerShell script (or something else) on the server that scans the IIS logs every few minutes and reports 500s via email.

  • Implement global error handling in your application, I don't know anything about WCF, in ASP.NET you would implement Application_Error in global.asax

  • Add more exception handling around the parsing of the XML, but this may be out of your hands because of WCF

Upvotes: 3

Related Questions