app.UseDeveloperExceptionPage() doesn't seem to be working on ASP .NET Core on Ubuntu

.net-core, asp.net, asp.net-core, c#, ubuntu

Solution

By default on macOS and Linux ASP.NET Core's Hosting environment is Production.

On Ubuntu you can start the application and set the Hosting environment from command line using

`> dotnet run --environment=Development`

For macOS:

`$ ASPNETCORE_ENVIRONMENT=Development dotnet run`

If you are using Visual Studio Code, in launch.json there's the following setting for each configuration:

` "env": { "ASPNETCORE_ENVIRONMENT": "Development" } `

Problem

Very simple ASP .NET core application so far. I've turned on the developer exception page as follows ``` public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); app.UseDeveloperExceptionPage(); app.UseMvc(); } ``` I've deployed it on windows as a portable app and i'm able to see the errors on the developer page (awesome page by the way) when a specific web API request fails with an exception. I publish the same app to Ubuntu as a self-contained app and I don't get the developer error page to show up (though the seems to run fine - i've hard coded an error just to test the developer page itself).

Original source