What is Raygun?

Raygun is an intelligent bug tracking service which gives you deep insight into the errors happening on your website and who it is happening to. You can find out so much information to help you reproduce the errors.

It even has real-time monitoring where you can see who is on your site now and what the experience is like for them. You can see the pages they visited on your site and the order they visited them in. You can see if any errors occurred during their session and how long different pages take to load.

You can also record bugs with the logged in user id, so you know exactly who has been affected by the error and you can get in touch with them before they even realise there was an error.

Create an account

  1. Go to raygun.com, click on the Free Trial button in the navigation menu.
  2. Enter your details
  3. Enter your application name and notification preferences, then click Next.
  4. When it asks you which language or framework you wish to monitor, choose ASP.NET

How to set it up for ASP.NET

  1. Open your project in Visual Studio
  2. Install the Raygun Nuget Package in your project:
Install-Package Mindscape.Raygun4Net
  1. Add the following settings to your web.config file at the root of your project:
<?xml version="1.0" encoding="utf-8"?>
<configuration>

<configSections>
<section name="RaygunSettings" type="Mindscape.Raygun4Net.RaygunSettings, Mindscape.Raygun4Net" />
</configSections>

<RaygunSettings apikey="xxxxxxxxxxxxxxxxxxxxxxxx" />

<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<add name="RaygunErrorModule" type="Mindscape.Raygun4Net.RaygunHttpModule" />
</modules>
</system.webServer>

</configuration>
  1. Go to Application Settings in the side navigation to get your API key, so you can replace the one in the settings above.
  2. Do a build and run your application. You should now start to see errors coming through in the dashboard, if you have any.

Real User Monitoring

If you want to see realtime error from people using your site, then you can set up the Real User Monitoring.

  1. Add this script to the top of the <body> of your master template.
<script type="text/javascript">
  !function(a,b,c,d,e,f,g,h){a.RaygunObject=e,a[e]=a[e]||function(){
  (a[e].o=a[e].o||[]).push(arguments)},f=b.createElement(c),g=b.getElementsByTagName(c)[0],
  f.async=1,f.src=d,g.parentNode.insertBefore(f,g),h=a.onerror,a.onerror=function(b,c,d,f,g){
  h&&h(b,c,d,f,g),g||(g=new Error(b)),a[e].q=a[e].q||[],a[e].q.push({
  e:g})}}(window,document,"script","//cdn.raygun.io/raygun4js/raygun.min.js","rg4js");
</script>
  1. Then add this below it, remeber to replace xxxxxxxx with your real api key:
<script type="text/javascript">
  rg4js('apiKey', 'xxxxxxxxxxxxxxxxxxxxxxxx');
  rg4js('enableCrashReporting', true);
  rg4js('enablePulse', true);
</script>

That's it, you're all set to start tracking errors in your application, and even in realtime.

Optional extra

If you want to you can track individual users by passing through their user details.

  1. Just add this to the bottom of the script above
<script type="text/javascript">
rg4js('setUser', {
identifier: 'users_email_address_or_unique_id',
isAnonymous: false,
email: '[email protected]',
firstName: 'Firstname',
fullName: 'Firstname Lastname'
});
</script>

Watch my video to find out more about Raygun

Watch on YouTube

Paul Seal

Umbraco MVP and .NET Web Developer from Derby (UK) who specialises in building Content Management System (CMS) websites using MVC with Umbraco as a framework. Paul is passionate about web development and programming as a whole. Apart from when he's with his wife and son, if he's not writing code, he's thinking about it or listening to a podcast about it.

Proudly sponsored by

Moriyama

  • Moriyama build, support and deploy Umbraco, Azure and ASP.NET websites and applications.
AppVeyor

  • CI/CD service for Windows, Linux and macOS
  • Build, test, deploy your apps faster, on any platform.
elmah.io

  • elmah.io is the easy error logging and uptime monitoring service for .NET.
  • Take back control of your errors with support for all .NET web and logging frameworks.
uSync Complete

  • uSync.Complete gives you all the uSync packages, allowing you to completely control how your Umbraco settings, content and media is stored, transferred and managed across all your Umbraco Installations.
uSkinned

  • More than a theme for Umbraco CMS, take full control of your content and design with a feature-rich, award-nominated & content editor focused website platform.
UmbHost

  • Affordable, Geo-Redundant, Umbraco hosting which gives back to the community by sponsoring an Umbraco Open Source Developer with each hosting package sold.