I'm just added Mini Profiler to my MVC3 project with nuget and I've followed the basic steps to get it set up. Starting the profile on Application_BeginRequest() and stopping it on Application_EndRequest()
protected void Application_BeginRequest()
{
if (Request.IsLocal)
{
MiniProfiler.Start();
}
}
protected void Application_EndRequest()
{
MiniProfiler.Stop();
}
MiniProfiler.Stop() is throwing an exception - "Server cannot append header after HTTP headers have been sent."
Has anybody else seen this?
Old question but answering anyway.
Problem caused by some component (SignalR
in my case) calls HttpResponse.Flush
.
Solved by excluding SignalR
from profiling. Below is a simple version of what we have done.
if (Request.IsLocal && !Request.Path.StartsWith("/signalr"))
{
MiniProfiler.Start();
}
Hope it helps.
This appears to be related to Combres (http://combres.codeplex.com/). If I ignore the requests for my js and css that has been combined and compressed with combres the profiler seems to work better (no exception being thrown)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With