473,473 Members | 1,723 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Application_Start()

RB
Hi!

Is it guaranteed that Application_Start() will only run once per application
start? In other words, what happens if 2 users simultaneousy hit a "fresh"
app? Does ASP.NET know to run only one thread?

Thanks!
RB
Nov 18 '05 #1
2 1425
A usefull link

http://msdn.microsoft.com/architectu...x?pull=/librar
y/en-us/dnnetsec/html/SecNetAP04.asp

You will get an Application_Start for each HttpApplication object

ASP.NET runtime creates as many instances of application class as is need
to process requests simultaneously. For most applications this number is
limited to the number of threads, and would stay in 1-100 range depending
on the hardware, server load, configuration, etc. Application instances are
reused for many requests, and a free list of application instances is kept
during the periods of reduced load. Application instances are utilized in a
thread safe manner, one request at a time. This has important implications:

Users don't need to worry about locking, to access non-static members of
the application class.
Application code can store per-request data in non-static members of the
application class (but not after EndRequest event, as it would keep the
request alive potentially for a long time).
Static members of application class, as of any class, are not thread safe,
and the user code needs to provide appropriate locking around access to
static members.

Andy Mortimer [MS]
Please do not send email directly to this alias. This alias is for
newsgroup purposes only

This posting is provided "AS IS" with no warranties, and confers no rights.
OR if you wish to include a script sample in your post please add "Use of
included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm"

Nov 18 '05 #2
The Application_OnStart Method is an Event Handler. As such, it will not
fire more than once, when the first request is received. There is no real
"simultaneous" request, although at the speed with which they are processed
it might seem so. Requests are queued.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"RB" <ri*****@nospam.com> wrote in message
news:9B*****************@newssvr24.news.prodigy.co m...
Hi!

Is it guaranteed that Application_Start() will only run once per application start? In other words, what happens if 2 users simultaneousy hit a "fresh" app? Does ASP.NET know to run only one thread?

Thanks!
RB

Nov 18 '05 #3

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...
6
by: Leslie | last post by:
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...
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...
6
by: Joe Befumo | last post by:
I just created the default personal site project in Visual Studio 2005, and it worked perfectly -- very nice. Next, I'd like to import some stat-capture code that I have working in a Visual Studio...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.