偶尔我会抛出这个异常(在 elmah 中可见)
System.Web.HttpException:
Server cannot append header after HTTP headers have been sent.
System.Reflection.TargetInvocationException: Exception has been thrown by the target
of an invocation. ---> System.Web.HttpException: Server cannot append header after
HTTP headers have been sent.
at System.Web.HttpHeaderCollection.SetHeader(String name, String value,
Boolean replace)
at System.Web.HttpHeaderCollection.Add(String name, String value)
at BettingOnYou.MvcApplication.Application_EndRequest() in /Global.asax.cs:line 55
Run Code Online (Sandbox Code Playgroud)
该行对应于:
protected void Application_EndRequest()
{
// By default, IE renders pages on the intranet (same subnet) in compatibility mode.
// IE=edge forces IE to render in …Run Code Online (Sandbox Code Playgroud)