asp.net 获得服务器信息
时间:2010-11-23 来源:世纪老妖
Label1.Text = "服务器名称:" + Server.MachineName;//服务器名称
Label2.Text = "服务器IP地址:" + Request.ServerVariables["LOCAL_ADDR"];//服务器IP地址
Label3.Text = "服务器域名:" + Request.ServerVariables["SERVER_NAME"];//服务器域名
Label4.Text = ".NET解释引擎版本:" + ".NET CLR" + Environment.Version.Major + "." + Environment.Version.Minor + "." + Environment.Version.Build + "." + Environment.Version.Revision;//.NET解释引擎版本
Label5.Text = "服务器操作系统版本:" + Environment.OSVersion.ToString();//服务器操作系统版本
Label6.Text = "服务器IIS版本:" + Request.ServerVariables["SERVER_SOFTWARE"];//服务器IIS版本
Label7.Text = "HTTP访问端口:" + Request.ServerVariables["SERVER_PORT"];//HTTP访问端口
Label8.Text = "虚拟目录的绝对路径:" + Request.ServerVariables["APPL_RHYSICAL_PATH"];//虚拟目录的绝对路径
Label9.Text = "执行文件的绝对路径:" + Request.ServerVariables["PATH_TRANSLATED"];//执行文件的绝对路径
Label10.Text = "虚拟目录Session总数:" + Session.Contents.Count.ToString();//虚拟目录Session总数
Label11.Text = "虚拟目录Application总数:" + Application.Contents.Count.ToString();//虚拟目录Application总数
Label12.Text = "域名主机:" + Request.ServerVariables["HTTP_HOST"];//域名主机
Label13.Text = "服务器区域语言:" + Request.ServerVariables["HTTP_ACCEPT_LANGUAGE"];//服务器区域语言
Label14.Text = "用户信息:" + Request.ServerVariables["HTTP_USER_AGENT"];
Label15.Text = "CPU个数:" + Environment.GetEnvironmentVariable("NUMBER_OF_PROCESSORS");//CPU个数
Label16.Text = "CPU类型:" + Environment.GetEnvironmentVariable("PROCESSOR_IDENTIFIER");//CPU类型
一些关于内存的
//aspnet内存
this.lblAN.Text = ((Double)Process.GetCurrentProcess().WorkingSet64 / 1048576).ToString("N2") + "M";
//aspnet cpu时间
this.lblAC.Text = ((TimeSpan)Process.GetCurrentProcess().TotalProcessorTime).TotalSeconds.ToString("N0");
////正在使用的内存
//this.lblSYNC.Text = (Environment.WorkingSet / 1024).ToString() + "M" + "M";
////共有物理内存
//this.lblGYWLNC.Text = (Environment.WorkingSet / 1024).ToString() + "M";
////剩余物理内
//this.lblWLNC.Text = (int)(Environment.WorkingSet / 1024).ToString() - (int)(Environment.WorkingSet / 1024).ToString() + "M";
相关阅读 更多 +










