创建了多少个变量实例? [英] How many instance of variable are created ?

查看:65
本文介绍了创建了多少个变量实例?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨专家,



我正在使用Asp.Net应用程序并在IIS 6.0中托管它。我有疑问我的应用程序是否在类级别使用静态变量,那么该变量对托管应用程序的行为是什么。



如何创建该变量的实例? br />


1)每个应用程序一个

2)每个应用程序池一个。

3)每个应用程序池工作者一个处理器(网络花园)。

4)还有别的吗?



我们假设我们的应用程序托管在一台服务器上,具有不同的场景,如

在一个应用程序池,多个应用程序池或一个应用程序池中托管应用程序在同一个应用程序池中。



我尝试过:



公共静态类ServiceLOC

{

public static int NoOfInstance = 0;

public static int GetInstanceCount()

{

}

}

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()
{
}
}

推荐答案

谷歌用答案显示了同样的问题: ASP.NET静态变量的生命周期 - 堆栈溢出 [ ^ ]



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

and more: Google[^]


这篇关于创建了多少个变量实例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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