System.Net.ServicePointManager Singleton的范围是什么

时间:2019-06-04 09:06:43

标签: .net powershell .net-core

如果我的计算机上运行着2个x = 1.283 ax = plt.subplot(1, 1, 1) setup(ax) movepoint = ax.plot(x, 0.02, 'rv') plt.pause(1) while x <= 1.3: movepoint.remove() x += 0.001 movepoint = ax.plot(x, 0.02, 'rv') plt.pause(0.000001) plt.show() 网站,并且打开了2个Asp.Net窗口,那么有多少个静态类PowerShell实例?

每台机器一个?每个应用程序域一个?每个进程一个?

1 个答案:

答案 0 :(得分:0)

文档中没有任何内容表明List<User_controls> ctrl = new List<User_controls>(); protected void Page_Load(object sender, EventArgs e) { Session["userid"] = 3; CreateControls(); } protected void CreateControls() { if (!IsPostBack) { if (ViewState["totalcount"] == null) { ViewState["oldcount"] = ViewState["totalcount"] = 1; } } for (int i = 0; i < (int)ViewState["totalcount"]; i++) { ctrl.Add((User_controls)LoadControl("~/User/controls.ascx")); int index = ctrl.Count - 1; pnl.Controls.Add(ctrl[index]); ctrl[index].ID = "ctrl " + index; ctrl[index].ehclick += new EventHandler(this.Btncancel_Click); } } protected void btnadd_Click(object sender, EventArgs e) { int count = 0; if (ViewState["newcount"] != null) count = (int)ViewState["newcount"]; count++; ViewState["newcount"] = count; ViewState["totalcount"] = (int)ViewState["newcount"] + (int)ViewState["oldcount"]; ctrl.Add((User_controls)LoadControl("~/User/controls.ascx")); pnl.Controls.Add(ctrl[ctrl.Count() - 1]); ctrl[ctrl.Count() - 1].ID = "ctrl " + (ctrl.Count() - 1); ctrl[ctrl.Count() - 1].ehclick += new EventHandler(this.Btncancel_Click); } protected void Btncancel_Click(object sender, EventArgs e) { User_controls rmctrl = (User_controls)sender; int index = ctrl.IndexOf(rmctrl); pnl.Controls.Remove(ctrl[index]); ctrl.RemoveAt(index); if (index < (int)ViewState["oldcount"]) { ViewState["oldcount"] = (int)ViewState["oldcount"] - 1; } else ViewState["newcount"] = (int)ViewState["newcount"] - 1; if (ViewState["newcount"] != null) { ViewState["totalcount"] = (int)ViewState["newcount"] + (int)ViewState["oldcount"]; } else ViewState["totalcount"] = (int)ViewState["oldcount"]; } 实例不是标准静态实例。

应遵循正常规则:应用程序域被销毁时,它会被销毁,我们推断每个应用程序域都有一个。

您可以通过打开两个Powershell Windows并输入

来验证ServicePointManager
PowerShell

其中之一和

[System.Net.ServicePointManager]::DefaultConnectionLimit--; [System.Net.ServicePointManager]::DefaultConnectionLimit

在另一个。