开发者

Application_Error not firing

I'm not able to get my Application_Error method to fire in global.asax. I've placed a breakpoint in the first line of my Application_Error function but it never breaks there. Instead, the server is returning the usual yellow formatted stack trace page and saying that "An unhandled exception occurred...." so I know an exception is being thrown.

Any advice? I'm using VS2010, C# 4.0, and running this in the Dev web server (via F5).

Global.asax

void Application_Error(object sender, EventArgs e)
{
        int i;
        i = 3;开发者_如何学编程   <==BREAKPOINT SET HERE, NEVER HITS
}

web.config

<customErrors mode="Off" />
...
<compilation debug="true" targetFramework="4.0">

Page that I see when Application_Error gets skipped:

Server Error in '/' Application.
--------------------------------------------------------------------------------
Invalid column name 'JobTypeID'. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Data.SqlClient.SqlException: Invalid column name 'JobTypeID'.

Source Error: 
Line 95: 
Line 96:             MyEntities context = Util.CurrentMasterContext();
Line 97:             UserRec = context.User
Line 98:                 .Include("Person")
Line 99:                 .Include("AccountType")


Ok, I remembered (realized) that I had a custom HttpModule. This handler was not implementing an event handler for the Error event so I added one and voila, this did fire.

But now my question has changed: if you register a custom HttpModule does this defeat the firing of all events at the global.asax level, even those events that your HttpModule isn't handling?

Does that make sense to any one?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜