473,320 Members | 1,945 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Application_Start exceptions

I am attempting to handle errors by using Application_Error. This seems to
work fine in most situations. However, if the exception occurs during the
Application_Start method, the stand error screen is displayed and my custom
error handling in Application_Error does not run.

Why does this occur, and is there something I can do to cause
Application_Error to be automatically invoked during an Application_Start
exception?
Nov 19 '05 #1
6 6427
Hi Leslie:

Have you tried stepping through Application_Start with the debugger?

With Visual studio, set a breakpoint [1] in Application Start and hit
F5 to launch the debugger. There is also a whitepaper with some links
on using the debugger [2].

You might also investigate Try / Catch blocks to handle the exception
and log it. You won't be able to get into Application_Error from
Application_Start because the request processing hasn't started as
yet, but you could still log the error.

[1]
http://msdn.microsoft.com/library/de...reakpoints.asp

[2]
http://msdn.microsoft.com/asp.net/us...debugging.aspx
--
Scott
http://www.OdeToCode.com/blogs/scott/

On Mon, 11 Jul 2005 15:43:03 -0700, Leslie <ma***@newsgroup.nospam>
wrote:
I am attempting to handle errors by using Application_Error. This seems to
work fine in most situations. However, if the exception occurs during the
Application_Start method, the stand error screen is displayed and my custom
error handling in Application_Error does not run.

Why does this occur, and is there something I can do to cause
Application_Error to be automatically invoked during an Application_Start
exception?


Nov 19 '05 #2
Thanks for Scott's inputs.

Hi Leslie,

As for the problem that exceptions in the Applicaion_Start event can't be
captured in Application_Error global event, it's limited by the ASP.NET's
error handling and request processing model:

The ASP.NET runtime will startup the application's instance(Application
instance) if found the applicaiton being requested the first time, and then
the Applicaiton_Start event will be fired. This event's event handler code
is executed before any other request processing code(event the httpmodule
code). And for Applicaiton_Error (the asp.net application global exception
event ) , it is implemented by put a large

try....catch.... block around the request Handler's ProcessRequest method,
and then unhandled exception occurs, the runtime call the global exception
handler( application_error) if exists in the catch block.

So we can see that any unhandled exception thrown in Application_Start is
out of the control of the Application_Error handler, if we need to capture
them, we have to explicitly put exception handling block in the
Applicaiton_Error handler.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


--------------------
| From: Scott Allen <sc***@nospam.odetocode.com>
| Subject: Re: Application_Start exceptions
| Date: Mon, 11 Jul 2005 20:31:29 -0400
| Message-ID: <cd********************************@4ax.com>
| References: <C7**********************************@microsoft.co m>
| X-Newsreader: Forte Agent 1.8/32.548
| MIME-Version: 1.0
| Content-Type: text/plain; charset=us-ascii
| Content-Transfer-Encoding: 7bit
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: dyn-13-227.myactv.net 24.89.13.227
| Lines: 1
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP12.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet:111583
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Hi Leslie:
|
| Have you tried stepping through Application_Start with the debugger?
|
| With Visual studio, set a breakpoint [1] in Application Start and hit
| F5 to launch the debugger. There is also a whitepaper with some links
| on using the debugger [2].
|
| You might also investigate Try / Catch blocks to handle the exception
| and log it. You won't be able to get into Application_Error from
| Application_Start because the request processing hasn't started as
| yet, but you could still log the error.
|
| [1]
|
http://msdn.microsoft.com/library/de...us/vsdebug/htm
l/_asug_setting_breakpoints.asp
|
| [2]
|
http://msdn.microsoft.com/asp.net/us...papers/debuggi
ng.aspx
|
|
| --
| Scott
| http://www.OdeToCode.com/blogs/scott/
|
| On Mon, 11 Jul 2005 15:43:03 -0700, Leslie <ma***@newsgroup.nospam>
| wrote:
|
| >I am attempting to handle errors by using Application_Error. This seems
to
| >work fine in most situations. However, if the exception occurs during
the
| >Application_Start method, the stand error screen is displayed and my
custom
| >error handling in Application_Error does not run.
| >
| >Why does this occur, and is there something I can do to cause
| >Application_Error to be automatically invoked during an
Application_Start
| >exception?
|
|

Nov 19 '05 #3
Thanks Scott and Steve,

This let's me know that I am not doing something wrong. I will put a
try/catch block in my Application_Start routine to catch the exceptions.

One other thing, Do you know of any Microsoft documentation that details out
the ASP.NET runtime processing you refer to below?

Thanks,

Leslie

"Steven Cheng[MSFT]" wrote:
Thanks for Scott's inputs.

Hi Leslie,

As for the problem that exceptions in the Applicaion_Start event can't be
captured in Application_Error global event, it's limited by the ASP.NET's
error handling and request processing model:

The ASP.NET runtime will startup the application's instance(Application
instance) if found the applicaiton being requested the first time, and then
the Applicaiton_Start event will be fired. This event's event handler code
is executed before any other request processing code(event the httpmodule
code). And for Applicaiton_Error (the asp.net application global exception
event ) , it is implemented by put a large

try....catch.... block around the request Handler's ProcessRequest method,
and then unhandled exception occurs, the runtime call the global exception
handler( application_error) if exists in the catch block.

So we can see that any unhandled exception thrown in Application_Start is
out of the control of the Application_Error handler, if we need to capture
them, we have to explicitly put exception handling block in the
Applicaiton_Error handler.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


--------------------
| From: Scott Allen <sc***@nospam.odetocode.com>
| Subject: Re: Application_Start exceptions
| Date: Mon, 11 Jul 2005 20:31:29 -0400
| Message-ID: <cd********************************@4ax.com>
| References: <C7**********************************@microsoft.co m>
| X-Newsreader: Forte Agent 1.8/32.548
| MIME-Version: 1.0
| Content-Type: text/plain; charset=us-ascii
| Content-Transfer-Encoding: 7bit
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: dyn-13-227.myactv.net 24.89.13.227
| Lines: 1
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP12.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet:111583
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Hi Leslie:
|
| Have you tried stepping through Application_Start with the debugger?
|
| With Visual studio, set a breakpoint [1] in Application Start and hit
| F5 to launch the debugger. There is also a whitepaper with some links
| on using the debugger [2].
|
| You might also investigate Try / Catch blocks to handle the exception
| and log it. You won't be able to get into Application_Error from
| Application_Start because the request processing hasn't started as
| yet, but you could still log the error.
|
| [1]
|
http://msdn.microsoft.com/library/de...us/vsdebug/htm
l/_asug_setting_breakpoints.asp
|
| [2]
|
http://msdn.microsoft.com/asp.net/us...papers/debuggi
ng.aspx
|
|
| --
| Scott
| http://www.OdeToCode.com/blogs/scott/
|
| On Mon, 11 Jul 2005 15:43:03 -0700, Leslie <ma***@newsgroup.nospam>
| wrote:
|
| >I am attempting to handle errors by using Application_Error. This seems
to
| >work fine in most situations. However, if the exception occurs during
the
| >Application_Start method, the stand error screen is displayed and my
custom
| >error handling in Application_Error does not run.
| >
| >Why does this occur, and is there something I can do to cause
| >Application_Error to be automatically invoked during an
Application_Start
| >exception?
|
|

Nov 19 '05 #4
Hi Leslie,

For the detailed description on the internal exception handling
implementation, there hasn't any document focus on this. I've ever seen
some MSDN tech articles (about the related topic ) mentioned this. Also
here are some msdn reference which are helpful for understanding the
ASP.NET's runtime request processing and the pipeline:

#The ASP.NET HTTP Runtime
http://msdn.microsoft.com/library/en...PNETHTTPRuntim
e.asp?frame=true

#Securely Implement Request Processing, Filtering, and Content Redirection
with HTTP Pipelines in ASP.NET
http://msdn.microsoft.com/msdnmag/is...s/default.aspx

In addition, I also recommend that you try using the .NET Reflector tool to
have a look at the reassemblied code of the HttpRuntime or Page class (the
ProcessRequest method) which will also greatly help us understanding the
internal mechanism.

Hope also helps. Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


--------------------
| Thread-Topic: Application_Start exceptions
| thread-index: AcWHwSJCXiyAY+QyQrGgdmgu0r4nzw==
| X-WBNR-Posting-Host: 128.158.92.43
| From: =?Utf-8?B?TGVzbGll?= <ma***@newsgroup.nospam>
| References: <C7**********************************@microsoft.co m>
<cd********************************@4ax.com>
<dL**************@TK2MSFTNGXA01.phx.gbl>
| Subject: Re: Application_Start exceptions
| Date: Wed, 13 Jul 2005 08:40:02 -0700
| Lines: 115
| Message-ID: <03**********************************@microsoft.co m>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet:111963
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Thanks Scott and Steve,
|
| This let's me know that I am not doing something wrong. I will put a
| try/catch block in my Application_Start routine to catch the exceptions.
|
| One other thing, Do you know of any Microsoft documentation that details
out
| the ASP.NET runtime processing you refer to below?
|
| Thanks,
|
| Leslie
|
| "Steven Cheng[MSFT]" wrote:
|
| > Thanks for Scott's inputs.
| >
| > Hi Leslie,
| >
| > As for the problem that exceptions in the Applicaion_Start event can't
be
| > captured in Application_Error global event, it's limited by the
ASP.NET's
| > error handling and request processing model:
| >
| > The ASP.NET runtime will startup the application's instance(Application
| > instance) if found the applicaiton being requested the first time, and
then
| > the Applicaiton_Start event will be fired. This event's event handler
code
| > is executed before any other request processing code(event the
httpmodule
| > code). And for Applicaiton_Error (the asp.net application global
exception
| > event ) , it is implemented by put a large
| >
| > try....catch.... block around the request Handler's ProcessRequest
method,
| > and then unhandled exception occurs, the runtime call the global
exception
| > handler( application_error) if exists in the catch block.
| >
| > So we can see that any unhandled exception thrown in Application_Start
is
| > out of the control of the Application_Error handler, if we need to
capture
| > them, we have to explicitly put exception handling block in the
| > Applicaiton_Error handler.
| >
| > Thanks,
| >
| > Steven Cheng
| > Microsoft Online Support
| >
| > Get Secure! www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| >
| >
| >
| >
| > --------------------
| > | From: Scott Allen <sc***@nospam.odetocode.com>
| > | Subject: Re: Application_Start exceptions
| > | Date: Mon, 11 Jul 2005 20:31:29 -0400
| > | Message-ID: <cd********************************@4ax.com>
| > | References: <C7**********************************@microsoft.co m>
| > | X-Newsreader: Forte Agent 1.8/32.548
| > | MIME-Version: 1.0
| > | Content-Type: text/plain; charset=us-ascii
| > | Content-Transfer-Encoding: 7bit
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet
| > | NNTP-Posting-Host: dyn-13-227.myactv.net 24.89.13.227
| > | Lines: 1
| > | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP12.phx.gbl
| > | Xref: TK2MSFTNGXA01.phx.gbl
| > microsoft.public.dotnet.framework.aspnet:111583
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| > |
| > | Hi Leslie:
| > |
| > | Have you tried stepping through Application_Start with the debugger?
| > |
| > | With Visual studio, set a breakpoint [1] in Application Start and hit
| > | F5 to launch the debugger. There is also a whitepaper with some links
| > | on using the debugger [2].
| > |
| > | You might also investigate Try / Catch blocks to handle the exception
| > | and log it. You won't be able to get into Application_Error from
| > | Application_Start because the request processing hasn't started as
| > | yet, but you could still log the error.
| > |
| > | [1]
| > |
| >
http://msdn.microsoft.com/library/de...us/vsdebug/htm
| > l/_asug_setting_breakpoints.asp
| > |
| > | [2]
| > |
| >
http://msdn.microsoft.com/asp.net/us...papers/debuggi
| > ng.aspx
| > |
| > |
| > | --
| > | Scott
| > | http://www.OdeToCode.com/blogs/scott/
| > |
| > | On Mon, 11 Jul 2005 15:43:03 -0700, Leslie <ma***@newsgroup.nospam>
| > | wrote:
| > |
| > | >I am attempting to handle errors by using Application_Error. This
seems
| > to
| > | >work fine in most situations. However, if the exception occurs
during
| > the
| > | >Application_Start method, the stand error screen is displayed and my
| > custom
| > | >error handling in Application_Error does not run.
| > | >
| > | >Why does this occur, and is there something I can do to cause
| > | >Application_Error to be automatically invoked during an
| > Application_Start
| > | >exception?
| > |
| > |
| >
| >
|

Nov 19 '05 #5
Thanks Steven,

That is what I was looking for.

Leslie
"Steven Cheng[MSFT]" <st*****@online.microsoft.com> wrote in message
news:Dz**************@TK2MSFTNGXA01.phx.gbl...
Hi Leslie,

For the detailed description on the internal exception handling
implementation, there hasn't any document focus on this. I've ever seen
some MSDN tech articles (about the related topic ) mentioned this. Also
here are some msdn reference which are helpful for understanding the
ASP.NET's runtime request processing and the pipeline:

#The ASP.NET HTTP Runtime
http://msdn.microsoft.com/library/en...PNETHTTPRuntim
e.asp?frame=true

#Securely Implement Request Processing, Filtering, and Content Redirection
with HTTP Pipelines in ASP.NET
http://msdn.microsoft.com/msdnmag/is...s/default.aspx

In addition, I also recommend that you try using the .NET Reflector tool
to
have a look at the reassemblied code of the HttpRuntime or Page class (the
ProcessRequest method) which will also greatly help us understanding the
internal mechanism.

Hope also helps. Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


--------------------
| Thread-Topic: Application_Start exceptions
| thread-index: AcWHwSJCXiyAY+QyQrGgdmgu0r4nzw==
| X-WBNR-Posting-Host: 128.158.92.43
| From: =?Utf-8?B?TGVzbGll?= <ma***@newsgroup.nospam>
| References: <C7**********************************@microsoft.co m>
<cd********************************@4ax.com>
<dL**************@TK2MSFTNGXA01.phx.gbl>
| Subject: Re: Application_Start exceptions
| Date: Wed, 13 Jul 2005 08:40:02 -0700
| Lines: 115
| Message-ID: <03**********************************@microsoft.co m>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet:111963
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Thanks Scott and Steve,
|
| This let's me know that I am not doing something wrong. I will put a
| try/catch block in my Application_Start routine to catch the exceptions.
|
| One other thing, Do you know of any Microsoft documentation that details
out
| the ASP.NET runtime processing you refer to below?
|
| Thanks,
|
| Leslie
|
| "Steven Cheng[MSFT]" wrote:
|
| > Thanks for Scott's inputs.
| >
| > Hi Leslie,
| >
| > As for the problem that exceptions in the Applicaion_Start event can't
be
| > captured in Application_Error global event, it's limited by the
ASP.NET's
| > error handling and request processing model:
| >
| > The ASP.NET runtime will startup the application's
instance(Application
| > instance) if found the applicaiton being requested the first time, and
then
| > the Applicaiton_Start event will be fired. This event's event handler
code
| > is executed before any other request processing code(event the
httpmodule
| > code). And for Applicaiton_Error (the asp.net application global
exception
| > event ) , it is implemented by put a large
| >
| > try....catch.... block around the request Handler's ProcessRequest
method,
| > and then unhandled exception occurs, the runtime call the global
exception
| > handler( application_error) if exists in the catch block.
| >
| > So we can see that any unhandled exception thrown in Application_Start
is
| > out of the control of the Application_Error handler, if we need to
capture
| > them, we have to explicitly put exception handling block in the
| > Applicaiton_Error handler.
| >
| > Thanks,
| >
| > Steven Cheng
| > Microsoft Online Support
| >
| > Get Secure! www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| >
| >
| >
| >
| > --------------------
| > | From: Scott Allen <sc***@nospam.odetocode.com>
| > | Subject: Re: Application_Start exceptions
| > | Date: Mon, 11 Jul 2005 20:31:29 -0400
| > | Message-ID: <cd********************************@4ax.com>
| > | References: <C7**********************************@microsoft.co m>
| > | X-Newsreader: Forte Agent 1.8/32.548
| > | MIME-Version: 1.0
| > | Content-Type: text/plain; charset=us-ascii
| > | Content-Transfer-Encoding: 7bit
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet
| > | NNTP-Posting-Host: dyn-13-227.myactv.net 24.89.13.227
| > | Lines: 1
| > | Path:
TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP12.phx.gbl
| > | Xref: TK2MSFTNGXA01.phx.gbl
| > microsoft.public.dotnet.framework.aspnet:111583
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| > |
| > | Hi Leslie:
| > |
| > | Have you tried stepping through Application_Start with the debugger?
| > |
| > | With Visual studio, set a breakpoint [1] in Application Start and
hit
| > | F5 to launch the debugger. There is also a whitepaper with some
links
| > | on using the debugger [2].
| > |
| > | You might also investigate Try / Catch blocks to handle the
exception
| > | and log it. You won't be able to get into Application_Error from
| > | Application_Start because the request processing hasn't started as
| > | yet, but you could still log the error.
| > |
| > | [1]
| > |
| >
http://msdn.microsoft.com/library/de...us/vsdebug/htm
| > l/_asug_setting_breakpoints.asp
| > |
| > | [2]
| > |
| >
http://msdn.microsoft.com/asp.net/us...papers/debuggi
| > ng.aspx
| > |
| > |
| > | --
| > | Scott
| > | http://www.OdeToCode.com/blogs/scott/
| > |
| > | On Mon, 11 Jul 2005 15:43:03 -0700, Leslie <ma***@newsgroup.nospam>
| > | wrote:
| > |
| > | >I am attempting to handle errors by using Application_Error. This
seems
| > to
| > | >work fine in most situations. However, if the exception occurs
during
| > the
| > | >Application_Start method, the stand error screen is displayed and
my
| > custom
| > | >error handling in Application_Error does not run.
| > | >
| > | >Why does this occur, and is there something I can do to cause
| > | >Application_Error to be automatically invoked during an
| > Application_Start
| > | >exception?
| > |
| > |
| >
| >
|

Nov 19 '05 #6
You're welcome :)

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| From: "Leslie Mason" <ma***@newsgroup.nospam>
| References: <C7**********************************@microsoft.co m>
<cd********************************@4ax.com>
<dL**************@TK2MSFTNGXA01.phx.gbl>
<03**********************************@microsoft.co m>
<Dz**************@TK2MSFTNGXA01.phx.gbl>
| Subject: Re: Application_Start exceptions
| Date: Thu, 14 Jul 2005 08:59:07 -0500
| Lines: 211
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| X-RFC2646: Format=Flowed; Original
| Message-ID: <u9**************@TK2MSFTNGP09.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: ip24-253-198-205.ok.ok.cox.net 24.253.198.205
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP09.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet:112179
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Thanks Steven,
|
| That is what I was looking for.
|
| Leslie
| "Steven Cheng[MSFT]" <st*****@online.microsoft.com> wrote in message
| news:Dz**************@TK2MSFTNGXA01.phx.gbl...
| > Hi Leslie,
| >
| > For the detailed description on the internal exception handling
| > implementation, there hasn't any document focus on this. I've ever seen
| > some MSDN tech articles (about the related topic ) mentioned this. Also
| > here are some msdn reference which are helpful for understanding the
| > ASP.NET's runtime request processing and the pipeline:
| >
| > #The ASP.NET HTTP Runtime
| >
http://msdn.microsoft.com/library/en...PNETHTTPRuntim
| > e.asp?frame=true
| >
| > #Securely Implement Request Processing, Filtering, and Content
Redirection
| > with HTTP Pipelines in ASP.NET
| >
http://msdn.microsoft.com/msdnmag/is...s/default.aspx
| >
| > In addition, I also recommend that you try using the .NET Reflector
tool
| > to
| > have a look at the reassemblied code of the HttpRuntime or Page class
(the
| > ProcessRequest method) which will also greatly help us understanding the
| > internal mechanism.
| >
| > Hope also helps. Thanks,
| >
| > Steven Cheng
| > Microsoft Online Support
| >
| > Get Secure! www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| >
| >
| >
| >
| >
| >
| > --------------------
| > | Thread-Topic: Application_Start exceptions
| > | thread-index: AcWHwSJCXiyAY+QyQrGgdmgu0r4nzw==
| > | X-WBNR-Posting-Host: 128.158.92.43
| > | From: =?Utf-8?B?TGVzbGll?= <ma***@newsgroup.nospam>
| > | References: <C7**********************************@microsoft.co m>
| > <cd********************************@4ax.com>
| > <dL**************@TK2MSFTNGXA01.phx.gbl>
| > | Subject: Re: Application_Start exceptions
| > | Date: Wed, 13 Jul 2005 08:40:02 -0700
| > | Lines: 115
| > | Message-ID: <03**********************************@microsoft.co m>
| > | MIME-Version: 1.0
| > | Content-Type: text/plain;
| > | charset="Utf-8"
| > | Content-Transfer-Encoding: 7bit
| > | X-Newsreader: Microsoft CDO for Windows 2000
| > | Content-Class: urn:content-classes:message
| > | Importance: normal
| > | Priority: normal
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet
| > | NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| > | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
| > | Xref: TK2MSFTNGXA01.phx.gbl
| > microsoft.public.dotnet.framework.aspnet:111963
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| > |
| > | Thanks Scott and Steve,
| > |
| > | This let's me know that I am not doing something wrong. I will put a
| > | try/catch block in my Application_Start routine to catch the
exceptions.
| > |
| > | One other thing, Do you know of any Microsoft documentation that
details
| > out
| > | the ASP.NET runtime processing you refer to below?
| > |
| > | Thanks,
| > |
| > | Leslie
| > |
| > | "Steven Cheng[MSFT]" wrote:
| > |
| > | > Thanks for Scott's inputs.
| > | >
| > | > Hi Leslie,
| > | >
| > | > As for the problem that exceptions in the Applicaion_Start event
can't
| > be
| > | > captured in Application_Error global event, it's limited by the
| > ASP.NET's
| > | > error handling and request processing model:
| > | >
| > | > The ASP.NET runtime will startup the application's
| > instance(Application
| > | > instance) if found the applicaiton being requested the first time,
and
| > then
| > | > the Applicaiton_Start event will be fired. This event's event
handler
| > code
| > | > is executed before any other request processing code(event the
| > httpmodule
| > | > code). And for Applicaiton_Error (the asp.net application global
| > exception
| > | > event ) , it is implemented by put a large
| > | >
| > | > try....catch.... block around the request Handler's ProcessRequest
| > method,
| > | > and then unhandled exception occurs, the runtime call the global
| > exception
| > | > handler( application_error) if exists in the catch block.
| > | >
| > | > So we can see that any unhandled exception thrown in
Application_Start
| > is
| > | > out of the control of the Application_Error handler, if we need to
| > capture
| > | > them, we have to explicitly put exception handling block in the
| > | > Applicaiton_Error handler.
| > | >
| > | > Thanks,
| > | >
| > | > Steven Cheng
| > | > Microsoft Online Support
| > | >
| > | > Get Secure! www.microsoft.com/security
| > | > (This posting is provided "AS IS", with no warranties, and confers
no
| > | > rights.)
| > | >
| > | >
| > | >
| > | >
| > | > --------------------
| > | > | From: Scott Allen <sc***@nospam.odetocode.com>
| > | > | Subject: Re: Application_Start exceptions
| > | > | Date: Mon, 11 Jul 2005 20:31:29 -0400
| > | > | Message-ID: <cd********************************@4ax.com>
| > | > | References: <C7**********************************@microsoft.co m>
| > | > | X-Newsreader: Forte Agent 1.8/32.548
| > | > | MIME-Version: 1.0
| > | > | Content-Type: text/plain; charset=us-ascii
| > | > | Content-Transfer-Encoding: 7bit
| > | > | Newsgroups: microsoft.public.dotnet.framework.aspnet
| > | > | NNTP-Posting-Host: dyn-13-227.myactv.net 24.89.13.227
| > | > | Lines: 1
| > | > | Path:
| > TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP12.phx.gbl
| > | > | Xref: TK2MSFTNGXA01.phx.gbl
| > | > microsoft.public.dotnet.framework.aspnet:111583
| > | > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| > | > |
| > | > | Hi Leslie:
| > | > |
| > | > | Have you tried stepping through Application_Start with the
debugger?
| > | > |
| > | > | With Visual studio, set a breakpoint [1] in Application Start and
| > hit
| > | > | F5 to launch the debugger. There is also a whitepaper with some
| > links
| > | > | on using the debugger [2].
| > | > |
| > | > | You might also investigate Try / Catch blocks to handle the
| > exception
| > | > | and log it. You won't be able to get into Application_Error from
| > | > | Application_Start because the request processing hasn't started as
| > | > | yet, but you could still log the error.
| > | > |
| > | > | [1]
| > | > |
| > | >
| >
http://msdn.microsoft.com/library/de...us/vsdebug/htm
| > | > l/_asug_setting_breakpoints.asp
| > | > |
| > | > | [2]
| > | > |
| > | >
| >
http://msdn.microsoft.com/asp.net/us...papers/debuggi
| > | > ng.aspx
| > | > |
| > | > |
| > | > | --
| > | > | Scott
| > | > | http://www.OdeToCode.com/blogs/scott/
| > | > |
| > | > | On Mon, 11 Jul 2005 15:43:03 -0700, Leslie
<ma***@newsgroup.nospam>
| > | > | wrote:
| > | > |
| > | > | >I am attempting to handle errors by using Application_Error.
This
| > seems
| > | > to
| > | > | >work fine in most situations. However, if the exception occurs
| > during
| > | > the
| > | > | >Application_Start method, the stand error screen is displayed
and
| > my
| > | > custom
| > | > | >error handling in Application_Error does not run.
| > | > | >
| > | > | >Why does this occur, and is there something I can do to cause
| > | > | >Application_Error to be automatically invoked during an
| > | > Application_Start
| > | > | >exception?
| > | > |
| > | > |
| > | >
| > | >
| > |
| >
|
|
|

Nov 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: AW | last post by:
Hi all, In my Application_Start, I'm initializing the application. ASP.Net calls my Application_Start on the first request, not on the following ones. However, if something goes wrong in my...
6
by: Ober | last post by:
I'm having trouble with my security model, Application_Start, and accessing my database. My ASP.NET app is only going to be running in an intranet environment (not on the public Internet). ...
3
by: msnews.microsoft.com | last post by:
Hi What can you do with the errors occuring in global.asax in Application_Start (or Init) ? What is the best practice here ? What's the elegant solution in this case ? For now (I'm learning)...
7
by: Gordon Smith | last post by:
I have four (4) ASP.NET Web applications/Web sites on a IIS/6 - Windows Server 2003 production server. 3 of them work fine. I just installed the 4th one and it's Application_Start event is not...
0
by: SeanGallavan | last post by:
Our Environment: Two network load balanced (using Microsoft NLB software) webservers with session maintained in a SQL Server database. NLB is configured with no affinity settings and two...
4
by: Marc Missire | last post by:
Hi, I have an issue below I'd love help with, involving a static variable, Application_Start, and a background thread. In global.asax.cs I have a static variable (outside any method) with a...
8
by: bryan | last post by:
Is there any way I can get the application path (the one returned by Request.ApplicationPath) in the Application_Start method in Global.asax? Request is not valid there. On a related note, is there...
4
by: NoNickname | last post by:
Hi, I need to get a string from a COM component at application start. (It's a Long Story and I cannot change this fact.) In ASP.NET 1.1, I simply called this COM component in Global.asax.cs...
4
by: David Thielen | last post by:
Hi; We can have an exception thrown in our Application_Start call. And if so, it does then go to Application_Error. However, in this case in Application_Error when we call:...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.