public void Configure(IApplicationBuilder app) { var transformations = BuildTransformations(); app.UseExceptionTransformations(transformations); app.Map("/throw", throwApp => { throwApp.Run(context => { throw new ArgumentOutOfRangeException("Application Exception"); }); }); app.Run(async context => { context.Response.ContentType = "text/html"; await context.Response.WriteAsync("<html><body>Welcome to the sample<br><br>\r\n"); await context.Response.WriteAsync("Click here to throw an exception: <a href=\"/throw\">throw</a>\r\n"); await context.Response.WriteAsync("</body></html>\r\n"); }); }