Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does an asp.net web-server run a new instance of a web application per request?

Tags:

c#

asp.net

I have a web application with private/protected methods or private/protected variables

First I would like to know when a web-server has a connection established already for a certain web application and then receives a new connection does it run a new instance of the web application for this new connection and thus re-initializing all the variables in that web application just like on a computer?

I have goggled the Internet and I am terribly confused!

Second I am using the visual studio development server and I have learned that it doesn't accept connections from other computers, I have gotten around this by using a port forwarding software. So the question is, By doing this does VS2010 web-server see each different requests as a new request or same request since am forwarding them from an app on the local computer?

Finally if I have a web application open on one browser and then decide to open it on another browser and keep the current browser open is this treated as a new request or a post-back?

like image 466
Fabio Delarias Avatar asked Jun 16 '13 10:06

Fabio Delarias


People also ask

What is an instance in Web application?

An instance is a single copy of the software running on a single physical or virtual server. If you run two copies of the software on the same physical or virtual server, that counts as two instances.

How the Web request is handled by the IIS server?

Protocol listeners receive protocol-specific requests, send them to IIS for processing, and then return responses to requestors. For example, when a client browser requests a Web page from the Internet, the HTTP listener, HTTP. sys, picks up the request and sends it to IIS for processing.

What are the stages in ASP.NET application request?

When an ASP.NET page executes, it undergoes a life cycle that includes various stages. The important stages in the page life cycle are Initialization, Load, Control Events, Rendering and Unload.


1 Answers

The app domain is constant (can be recycled) and is created only on the first request (also can be set before that).

That is to say all the static variables are initialized only once but all the not static classes on which your request depends are initialized on every request.

So basically all your pages in normal asp.net and all the controllers in asp.net MVC are initialized on every request.

read more about it here http://www.codeproject.com/Articles/73728/ASP-NET-Application-and-Page-Life-Cycle

enter image description here

*note - the image has been take from the article referred above

like image 105
Parv Sharma Avatar answered Oct 13 '22 00:10

Parv Sharma