Skip to content

Instantly share code, notes, and snippets.

@CoreProgramm
Created April 29, 2020 18:41
Show Gist options
  • Save CoreProgramm/d9277ef91c1801b2b13b8411e590c26c to your computer and use it in GitHub Desktop.
Save CoreProgramm/d9277ef91c1801b2b13b8411e590c26c to your computer and use it in GitHub Desktop.
ASP .NET Core Developer Exception Page
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseRouting();
app.UseEndpoints(endpoints =>
{
endpoints.MapGet("/", async context =>
{
throw new Exception("Error Occurred while processing your request");
await context.Response.WriteAsync("Hello World!");
});
});
if (env.IsDevelopment())
{
DeveloperExceptionPageOptions developerExceptionPageOptions =
new DeveloperExceptionPageOptions
{
SourceCodeLineCount = 10
};
app.UseDeveloperExceptionPage(developerExceptionPageOptions);
}
// app.UseFileServer();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment