Windows service exception handling with Raygun

John-DanielProduct UpdatesLeave a Comment

One of our users recently asked about Windows service exception handling with Raygun. We include many examples on using Raygun with web sites, desktop apps and mobile apps but nothing about services so I thought it would make a good post.

First of all, with your Raygun account setup, create a new application. Give it the name of your service. You just need to grab the API key for the new app.

Inside your Windows Service app add the following:

You’ll also want to install the Raygun4net nuget package.

Lastly, because we’re hooking at the current AppDomain, be aware that if your Windows Service is going to be spinning up multiple app domains (not common, but maybe you are), remember you’ll want to hook this event for each app domain created.

I hope that helps!

Create your account

Every Raygun user gets a 30 day trial – no credit card required. You can sign up in a matter of seconds. It couldn’t be easier to be improving your software quality.

Next level software intelligence across your entire stack. Get deeper analysis into how your applications are really performing. Learn more.

Leave a Reply

Your email address will not be published. Required fields are marked *