Raygun可以用于报告Azure工作角色中未捕获的异常吗?还是捕获的异常必须手动发送到Raygun?我已将以下行添加到我的app.config 中
<configSections>
<section name="RaygunSettings" type="Mindscape.Raygun4Net.RaygunSettings, Mindscape.Raygun4Net" />
</configSections>
<RaygunSettings apikey="my_key" />
我还在WorkerRole.cs中添加了以下内容:
public class WorkerRole : RoleEntryPoint, IRaygunApplication
{
private static readonly RaygunClient _raygunClient = new RaygunClient();
public RaygunClient GenerateRaygunClient()
{
return _raygunClient;
}
}
我只需要按照这里的说明进行操作。
工作人员角色的完整设置是:
将您的api密钥添加到服务配置
<ConfigurationSettings>
<Setting name="Raygun.ApiKey" value="my_key" />
</ConfigurationSettings>
安装RayGun4Net Nuget软件包:https://www.nuget.org/packages/Mindscape.Raygun4Net/
在app.config 中添加一个节
configSections>
<section name="RaygunSettings" type="Mindscape.Raygun4Net.RaygunSettings, Mindscape.Raygun4Net" />
</configSections>
更新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);
}