Click here to Skip to main content
15,885,067 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Experts,

I am using Asp.Net application and hosted it in IIS 6.0. I have question if my application is using static variable at class level then what is behaviour of that variable for hosted application.

How may instance of that variable are created?

1)One per application
2)One per application pool.
3)One per app pool worker processor(web garden).
4)Any thing else?

we assume that our application host on one server with different scenario like
hosting application in one app pool,multiple app pool or one app pool multiple application on same.

What I have tried:

public static class ServiceLOC
{
public static int NoOfInstance = 0;
public static int GetInstanceCount()
{
}
}
Posted
Updated 9-Aug-16 16:57pm

1 solution

google reveals the same question with an answer: Lifetime of ASP.NET Static Variable - Stack Overflow[^]

and more: Google[^]
 
Share this answer
 
v2
Comments
Maciej Los 10-Aug-16 1:58am    
Short and to the point! 5ed!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900