You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use WebMarkupMin only for MVC content (because all static files are already compressed/minified), but I want to use DeveloperExceptionPageMiddleware (app.UseDeveloperExceptionPage()) earlier in pipeline, because I want it to handle exceptions in identity/auth/... middleware too.
With this config, if any exception occurs (in MVC) - server returns blank page and I see exception in console window from DeveloperExceptionPageMiddleware:
fail: Microsoft.AspNet.Diagnostics.DeveloperExceptionPageMiddleware[0]
An exception was thrown attempting to display the error page.
System.ArgumentException: Stream was not writable.
at System.IO.StreamWriter..ctor(Stream stream, Encoding encoding, Int32 bufferSize, Boolean leaveOpen)
at Microsoft.AspNet.Diagnostics.Views.BaseView.d__28.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNet.Diagnostics.DeveloperExceptionPageMiddleware.d__7.MoveNext()
I guess this happens because WebMarkupMin already wrote compressed content (empty page?) into output response stream, and DeveloperExceptionPageMiddleware can't re-write this stream again.
Exception page shows successfully if I move UseDeveloperExceptionPage() after UseWebMarkupMin(), like this:
I tried to place UseDeveloperExceptionPage() immediately before UseWebMarkupMin() - problem still here, DeveloperExceptionPageMiddleware fails and error page not rendered.
This means that other middleware (UseIdentity, UseRequestLocalization) are not "guilty".
In my
Startup.cs
I haveConfigure
method like this:I use
WebMarkupMin
only for MVC content (because all static files are already compressed/minified), but I want to useDeveloperExceptionPageMiddleware
(app.UseDeveloperExceptionPage()
) earlier in pipeline, because I want it to handle exceptions in identity/auth/... middleware too.With this config, if any exception occurs (in MVC) - server returns blank page and I see exception in console window from DeveloperExceptionPageMiddleware:
I guess this happens because
WebMarkupMin
already wrote compressed content (empty page?) into output response stream, andDeveloperExceptionPageMiddleware
can't re-write this stream again.Exception page shows successfully if I move
UseDeveloperExceptionPage()
afterUseWebMarkupMin()
, like this:But I lose any details about exceptions in non-MVC middleware.
The text was updated successfully, but these errors were encountered: