获取服务器信息

ServerOS = Environment.OSVersion.ToString(); //操作系统:
CpuSum = Environment.GetEnvironmentVariable("NUMBER_OF_PROCESSORS"); //CPU个数:
CpuType = Environment.GetEnvironmentVariable("PROCESSOR_IDENTIFIER"); //CPU类型:
ServerSoft = Request.ServerVariables["SERVER_SOFTWARE"]; //信息服务软件:
MachineName = Server.MachineName; //服务器名
ServerName = Request.ServerVariables["SERVER_NAME"]; //服务器域名
ServerPath = Request.ServerVariables["APPL_PHYSICAL_PATH"]; //虚拟服务绝对路径
ServerNet = ".NET CLR " + Environment.Version.ToString(); //.NET 版本
ServerArea = (DateTime.Now - DateTime.UtcNow).TotalHours > 0 ? "+" + (DateTime.Now - DateTime.UtcNow).TotalHours.ToString() : (DateTime.Now - DateTime.UtcNow).TotalHours.ToString(); //服务器时区
ServerTimeOut = Server.ScriptTimeout.ToString(); //脚本超时时间
ServerStart = ((Double)System.Environment.TickCount / 3600000).ToString("N2"); //开机运行时长
PrStart = GetPrStart(); //进程开始时间
AspNetN = GetAspNetN(); //AspNet 内存占用
AspNetCpu = GetAspNetCpu(); //AspNet CPU时间
ServerSessions = Session.Contents.Count.ToString(); //Session总数
ServerApp = Application.Contents.Count.ToString(); //Application总数
ServerCache = Cache.Count.ToString(); //应用程序缓存总数
ServerAppN = GetServerAppN(); //应用程序占用内存
ServerFso = Check("Scripting.FileSystemObject"); //FSO 文本文件读写
ServerTimeOut = Server.ScriptTimeout.ToString() + "毫秒"; //本页执行时间 

posted @ 2012-03-09 08:24  Chaoa  阅读(395)  评论(0编辑  收藏  举报