0

If a static class is put in App_Code, does that imply only one instance will be created, shared by different http requests?

Or each request still brings one request?

Thanks.

3 Answers 3

2

The static instances will be shared between all requests. See this question:

Are static class instances unique to a request or a server in ASP.NET?

Sign up to request clarification or add additional context in comments.

Comments

1

You will have one instance for each worker process. You can have several worker processes on one machine handling requests for the same website (a "web garden").

The instance will be shared for all requests in that worker process only.

In addition, there can be two worker processes running for a short time during AppPool recycling, since it's done using a roll-over process (the old worker continues to process old requests while the new worker handles new ones).

Comments

1

There will be no instance at all!

static classes are never instantiated.

1 Comment

Could u provide the reference?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.