dyedurham / SbManager

Installable web ui for managing Azure/Windows Service Bus
Apache License 2.0
31 stars 16 forks source link

Setup error page as the very first middleware in the OWIN pipeline #94

Closed 0xced closed 6 years ago

0xced commented 6 years ago

The documentation for IAppBuilder.UseErrorPage() states this:

Captures synchronous and asynchronous exceptions from the pipeline and generates HTML error responses.

If the error page is setup as the last middleware, it will not capture anything. The UseDeveloperExceptionPage equivalent feature of ASP.NET Core documentation is clear about this:

Put UseDeveloperExceptionPage before any middleware you want to catch exceptions in, such as app.UseMvc.


IAppBuilder.UseErrorPage() documentation also states this:

Full error details are only displayed by default if 'host.AppMode' is set to 'development' in the IAppBuilder.Properties.

The easiest way to set the host.AppMode to development is to set the VisualStudioVersion environment variable to anything non whitespace. I guess that this is done automatically when running from Visual Studio. If you are using JetBrains Rider then adding VisualStudioVersion=Rider environment variable in the Run/Debug configuration will do the trick to get full error details with stack trace. (I found this by reading the Microsoft.Owin.Hosting implementation.)