ASP .NET 单例 [英] ASP .NET Singleton

查看:27
本文介绍了ASP .NET 单例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只是想确保我没有在这里假设一些愚蠢的事情,在 ASP .Net Web 应用程序中实现单例模式时,静态变量范围仅适用于当前用户会话,对吗?如果第二个用户正在访问该站点,则它是不同的内存范围......?

Just want to make sure I am not assuming something foolish here, when implementing the singleton pattern in an ASP .Net web application the static variable scope is only for the current user session, right? If a second user is accessing the site it is a different memory scope...?

推荐答案

静态变量作用域适用于整个应用程序域,这意味着其他会话也可以访问它.仅当您的服务器场具有不同的服务器时,您才会拥有多个变量实例.

The static variable scope is for the entire app domain, which means other sessions also have access to it. Only if you have a farm with different servers you would have more than one instance of the variable.

这篇关于ASP .NET 单例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆