Re: How do I show an error happening in Application_Start ?

From: Scott Allen (scott_at_nospam.odetocode.com)
Date: 01/31/05


Date: Mon, 31 Jan 2005 10:22:52 -0500

Let's start with just the Init event questions:

Each HttpApplication instance does fire Init when it instantiates, but
these objects are then pooled and used throughout the life of the
application. It's possible then that you'll only see Init fired a
handful of times.

http://odetocode.com/Articles/89.aspx

Make sense?

--
Scott
http://www.OdeToCode.com/blogs/scott/
On Mon, 31 Jan 2005 00:45:39 -0500, "msnews.microsoft.com"
<REMOVETHIScuca_macaii2000@yahoo.com> wrote:
>Me again - I'll try to be more explicit - if the error is in 
>Application_Start, I understand that the error will occur ONLY ONCE, after 
>I'm done with editing the global_asax file. When I run the project again, it 
>won't even pass by there, so in this case if I need to rely on some value 
>set in Application_Start I will be screwed.
>
>So I thought that this means that, to avoid this possibility, it is actually 
>not a good thing to have code in "Application_Start", but rather in "Init".
>I read that the Init event is raised each time a new instance is created 
>(already this is *NOT* a very good thing, because I might want to execute 
>that code only once, and not once for each instance). However, to my grand 
>surprise, the same thing happens - my code, which is set to provoke an 
>error, is executed, again, only once - when I "F5" again in VS.Net, the 
>execution does not even pass by INIT. Is this NOT a new instance ???
>
>Then I thought: Let's imagine that I need to cache a 'Settings' table to be 
>shared across all instances of my application, so I write code for reading 
>that table in "Application_Start".
>
>Let's say that this table belongs to the database "A" on server "SA". Let's 
>say that the rest of my app works with tables in the database "B" on server 
>"SB". What happens in the case where I start the app normally, and then SA 
>fails and I need to read that table again because the cache has been cleared 
>by the system ? Since the app will never pass thru "Application_Start" 
>again.... what can I do short of restarting SA and asking *ALL* the users to 
>restart their applications ?
>What if one of the many users does not close the application ? That would 
>mean that all instances but one have been closed, and that would mean that 
>my application is still not closed i.e. I cannot execute the code in 
>Application_Start.
>
>Sorry, I'm very confused about this - Application vs. Instances, and error 
>handling, not to mention that not even INIT is executed on each run. Could 
>you please be so kind to clarify this for me ?
>
>Thank you for reading this long post.
>Alex. 
>


Relevant Pages

  • I want increase the space of home folder - plz help me regarding this
    ... I want to increase the HDD space for /home ... No more tasks for init ... > try to execute ash instead of init ... Going to execute /sbin/init ...
    (RedHat)
  • Re: How to iterate through 80-100 procedures?
    ... programming wall that I don't quite know how to get past, ... inline asm code) and I need to be able to execute each test ... Each test is embedded in an object with an init ... demonstrates the use of these procedural types, ...
    (comp.lang.pascal.borland)
  • Re: Query in adding application in Linux
    ... For 'test' to execute it must have the executable flag set, in this case for the root user, ... init is a program on the embeded system that starts all other processes. ... As init itself is an executable, you will have to find init,c on your embedded system, ... int start_telnetd ...
    (comp.os.linux.development.apps)
  • some UMSDOS issues
    ... Using the Slackware lowmem kernel, as well as my own 2.4.24 kernel; ... will load init okay, but anything init tries to run (such as ... INIT: cannot execute "/sbin/agetty" ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)
  • Re: Book for Understanding the Minutia?
    ... copying the init and reader code directly from the board maker's diagnosis app. ... for your processor and for your peripherals. ...
    (comp.arch.embedded)

Loading