Application_Start exceptions

G

Guest

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?
 
S

Scott Allen

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/d...us/vsdebug/html/_asug_setting_breakpoints.asp

[2]
http://msdn.microsoft.com/asp.net/using/migrating/phpmig/whitepapers/debugging.aspx
 
S

Steven Cheng[MSFT]

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 <[email protected]>
| Subject: Re: Application_Start exceptions
| Date: Mon, 11 Jul 2005 20:31:29 -0400
| Message-ID: <[email protected]>
| References: <[email protected]>
| 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!TK2MSFTNGP12.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/default.asp?url=/library/en-us/vsdebug/htm
l/_asug_setting_breakpoints.asp
|
| [2]
|
http://msdn.microsoft.com/asp.net/using/migrating/phpmig/whitepapers/debuggi
ng.aspx
|
|
| --
| Scott
| http://www.OdeToCode.com/blogs/scott/
|
| On Mon, 11 Jul 2005 15:43:03 -0700, Leslie <[email protected]>
| 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?
|
|
 
G

Guest

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 said:
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 <[email protected]>
| Subject: Re: Application_Start exceptions
| Date: Mon, 11 Jul 2005 20:31:29 -0400
| Message-ID: <[email protected]>
| References: <[email protected]>
| 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!TK2MSFTNGP12.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/default.asp?url=/library/en-us/vsdebug/htm
l/_asug_setting_breakpoints.asp
|
| [2]
|
http://msdn.microsoft.com/asp.net/using/migrating/phpmig/whitepapers/debuggi
ng.aspx
|
|
| --
| Scott
| http://www.OdeToCode.com/blogs/scott/
|
| On Mon, 11 Jul 2005 15:43:03 -0700, Leslie <[email protected]>
| 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?
|
|
 
S

Steven Cheng[MSFT]

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-us/dnaspp/html/dngrfTheASPNETHTTPRuntim
e.asp?frame=true

#Securely Implement Request Processing, Filtering, and Content Redirection
with HTTP Pipelines in ASP.NET
http://msdn.microsoft.com/msdnmag/issues/02/09/HTTPPipelines/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?= <[email protected]>
| References: <[email protected]>
<[email protected]>
<[email protected]>
| Subject: Re: Application_Start exceptions
| Date: Wed, 13 Jul 2005 08:40:02 -0700
| Lines: 115
| Message-ID: <[email protected]>
| 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 <[email protected]>
| > | Subject: Re: Application_Start exceptions
| > | Date: Mon, 11 Jul 2005 20:31:29 -0400
| > | Message-ID: <[email protected]>
| > | References: <[email protected]>
| > | 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!TK2MSFTNGP12.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/default.asp?url=/library/en-us/vsdebug/htm
| > l/_asug_setting_breakpoints.asp
| > |
| > | [2]
| > |
| >
http://msdn.microsoft.com/asp.net/using/migrating/phpmig/whitepapers/debuggi
| > ng.aspx
| > |
| > |
| > | --
| > | Scott
| > | http://www.OdeToCode.com/blogs/scott/
| > |
| > | On Mon, 11 Jul 2005 15:43:03 -0700, Leslie <[email protected]>
| > | 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?
| > |
| > |
| >
| >
|
 
L

Leslie Mason

Thanks Steven,

That is what I was looking for.

Leslie
Steven Cheng said:
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-us/dnaspp/html/dngrfTheASPNETHTTPRuntim
e.asp?frame=true

#Securely Implement Request Processing, Filtering, and Content Redirection
with HTTP Pipelines in ASP.NET
http://msdn.microsoft.com/msdnmag/issues/02/09/HTTPPipelines/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?= <[email protected]>
| References: <[email protected]>
<[email protected]>
<[email protected]>
| Subject: Re: Application_Start exceptions
| Date: Wed, 13 Jul 2005 08:40:02 -0700
| Lines: 115
| Message-ID: <[email protected]>
| 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 <[email protected]>
| > | Subject: Re: Application_Start exceptions
| > | Date: Mon, 11 Jul 2005 20:31:29 -0400
| > | Message-ID: <[email protected]>
| > | References: <[email protected]>
| > | 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!TK2MSFTNGP12.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/default.asp?url=/library/en-us/vsdebug/htm
| > l/_asug_setting_breakpoints.asp
| > |
| > | [2]
| > |
| >
http://msdn.microsoft.com/asp.net/using/migrating/phpmig/whitepapers/debuggi
| > ng.aspx
| > |
| > |
| > | --
| > | Scott
| > | http://www.OdeToCode.com/blogs/scott/
| > |
| > | On Mon, 11 Jul 2005 15:43:03 -0700, Leslie <[email protected]>
| > | 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?
| > |
| > |
| >
| >
|
 
S

Steven Cheng[MSFT]

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" <[email protected]>
| References: <[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
| 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: <[email protected]>
| 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!TK2MSFTNGP09.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
| | > 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-us/dnaspp/html/dngrfTheASPNETHTTPRuntim
| > e.asp?frame=true
| >
| > #Securely Implement Request Processing, Filtering, and Content
Redirection
| > with HTTP Pipelines in ASP.NET
| >
http://msdn.microsoft.com/msdnmag/issues/02/09/HTTPPipelines/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?= <[email protected]>
| > | References: <[email protected]>
| > <[email protected]>
| > <[email protected]>
| > | Subject: Re: Application_Start exceptions
| > | Date: Wed, 13 Jul 2005 08:40:02 -0700
| > | Lines: 115
| > | Message-ID: <[email protected]>
| > | 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 <[email protected]>
| > | > | Subject: Re: Application_Start exceptions
| > | > | Date: Mon, 11 Jul 2005 20:31:29 -0400
| > | > | Message-ID: <[email protected]>
| > | > | References: <[email protected]>
| > | > | 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!TK2MSFTNGP12.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/default.asp?url=/library/en-us/vsdebug/htm
| > | > l/_asug_setting_breakpoints.asp
| > | > |
| > | > | [2]
| > | > |
| > | >
| >
http://msdn.microsoft.com/asp.net/using/migrating/phpmig/whitepapers/debuggi
| > | > ng.aspx
| > | > |
| > | > |
| > | > | --
| > | > | Scott
| > | > | http://www.OdeToCode.com/blogs/scott/
| > | > |
| > | > | On Mon, 11 Jul 2005 15:43:03 -0700, Leslie
<[email protected]>
| > | > | 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?
| > | > |
| > | > |
| > | >
| > | >
| > |
| >
|
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top