1

In PHP (Apache + mod_php) the interpreter is restarted on every request. This is the execution model even if using PHP-fpm which keeps a few interpreters ready for requests.

Does an ASP.NET web app persist in IIS application pool waiting for requests or is there a new thread/process per request?

For example, would a static class variable persist across requests when one of those requests initializes it?

xst
  • 2,536
  • 5
  • 29
  • 41
  • Is your actual question _"How can I persist application-level variables in ASP.NET"_? – CodeCaster Jun 17 '14 at 21:22
  • 1
    possible duplicate of [Lifetime of ASP.NET Static Variable](http://stackoverflow.com/questions/8919095/lifetime-of-asp-net-static-variable) – CodeCaster Jun 17 '14 at 21:23
  • @CodeCaster the static variables context sparked the question but I'm more interested in whether the application persists across requests or if it is restarted as PHP is – xst Jun 17 '14 at 21:24

1 Answers1

0

Yes, the value is persisted across requests.

A static class variable's (a field's) value is persisted and shared across all usage of the class (whether via an instantiated object or through the class reference itself). See http://msdn.microsoft.com/en-us/library/aa691162(v=vs.71).aspx

Babak Naffas
  • 12,395
  • 3
  • 34
  • 49