Мне не удалось запустить метод Application_Error в global.asax. Я поместил точку останова в первую строку моей функции Application_Error, но она там никогда не прерывается. Вместо этого сервер возвращает обычную страницу трассировки стека в желтом формате и говорит, что «произошло необработанное исключение ....», поэтому я знаю, что генерируется исключение.
Любой совет? Я использую VS2010, C # 4.0 и запускаю его на веб-сервере Dev (через 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">
Страница, которую я вижу, когда Application_Error пропускается:
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")