一、添加项目
创建选择ASP.NET Core项目类型
配置
代码
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
ExceptionlessClient.Default.Configuration.ApiKey = Configuration.GetSection("Exceptionless:ApiKey").Value;
ExceptionlessClient.Default.Configuration.ServerUrl = Configuration.GetSection("Exceptionless:ServerUrl").Value;
app.UseExceptionless();
app.UseMvc();
}
使用
[Route("api/[controller]")]
public class ValuesController : Controller
{
[HttpGet]
public ActionResult Get()
{
try
{
throw new Exception("LouieGuo测试项目的异常");
}
catch (Exception ex)
{
ex.ToExceptionless().Submit(); //这个很重要
}
return Ok();
}
}
测试结果
点到为止