Can Raygun be used to report uncaught exceptions in an Azure worker role? Or do caught exceptions have to be sent to Raygun manually? I have added the following lines to my app.config
<configSections>
<section name="RaygunSettings" type="Mindscape.Raygun4Net.RaygunSettings, Mindscape.Raygun4Net" />
</configSections>
<RaygunSettings apikey="my_key" />
I have also added the following to WorkerRole.cs:
public class WorkerRole : RoleEntryPoint, IRaygunApplication
{
private static readonly RaygunClient _raygunClient = new RaygunClient();
public RaygunClient GenerateRaygunClient()
{
return _raygunClient;
}
}
I just needed to follow the instructions here.
The complete set up for a worker role is:
Add your api key to the service configuration
<ConfigurationSettings>
<Setting name="Raygun.ApiKey" value="my_key" />
</ConfigurationSettings>
Install the RayGun4Net Nuget package: https://www.nuget.org/packages/Mindscape.Raygun4Net/
Add a section to your app.config
configSections>
<section name="RaygunSettings" type="Mindscape.Raygun4Net.RaygunSettings, Mindscape.Raygun4Net" />
</configSections>
Update WorkerRole.cs
public override bool OnStart()
{
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
return base.OnStart();
}
void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
var raygunClient = new RaygunClient(ConfigHelpers.GetAppSetting("Raygun.ApiKey"));
raygunClient.Send((Exception)e.ExceptionObject);
}