zoukankan      html  css  js  c++  java
  • ASP.net常用的显示系统信息

    //服务器计算机名:[lbServerName]
                    lbServerName.Text = "http://" + HttpContext.Current.Request.Url.Host + HttpContext.Current.Request.ApplicationPath;
                    //服务器IP地址:[lbIp]
                    lbIp.Text = Request.ServerVariables["LOCAl_ADDR"];
                    //服务器域名:[lbDomain]
                    lbDomain.Text = Request.ServerVariables["SERVER_NAME"].ToString();
                    //服务器端口:[lbPort]
                    lbPort.Text = Request.ServerVariables["Server_Port"].ToString();
                    //服务器IIS版本:[lbIISVer]
                    lbIISVer.Text = Request.ServerVariables["Server_SoftWare"].ToString();
                    //本文件所在文件夹:[lbPhPath]
                    lbPhPath.Text = Request.PhysicalApplicationPath;
                    //服务器操作系统:[lbOperat]
                    lbOperat.Text = Environment.OSVersion.ToString();
                    //系统所在文件夹:[lbSystemPath]
                    lbSystemPath.Text = Environment.SystemDirectory.ToString();
                    //服务器脚本超时时间:[lbTimeOut]
                    lbTimeOut.Text = (Server.ScriptTimeout / 1000).ToString() + "秒";
                    //服务器的语言种类:[lbLan]
                    lbLan.Text = CultureInfo.InstalledUICulture.EnglishName;
                    //.NET Framework 版本:[lbAspnetVer]
                    lbAspnetVer.Text = string.Concat(new object[] { Environment.Version.Major, ".", Environment.Version.Minor, Environment.Version.Build, ".", Environment.Version.Revision });
                    //服务器当前时间:[lbCurrentTime]
                    lbCurrentTime.Text = DateTime.Now.ToString();
    
                    RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Internet Explorer\Version Vector");
                    //服务器IE版本:[lbIEVer]
                    lbIEVer.Text = key.GetValue("IE", "未检测到").ToString();
                    //服务器上次启动到现在已运行:[lbServerLastStartToNow]
                    lbServerLastStartToNow.Text = ((Environment.TickCount / 0x3e8) / 60).ToString() + "分钟";
    
                    string[] achDrives = Directory.GetLogicalDrives();
                    for (int i = 0; i < Directory.GetLogicalDrives().Length - 1; i++)
                    {
                        //逻辑驱动器:[lbLogicDriver]
                        lbLogicDriver.Text = lbLogicDriver.Text + achDrives[i].ToString();
                    }
    
                    //ManagementClass diskClass = new ManagementClass("NUMBER_OF_PROCESSORS");
                    //CPU 总数:[lbCpuNum]个
                    lbCpuNum.Text = Environment.GetEnvironmentVariable("NUMBER_OF_PROCESSORS").ToString();
                    //CPU 类型:[lbCpuType]
                    lbCpuType.Text = Environment.GetEnvironmentVariable("PROCESSOR_IDENTIFIER").ToString();
                    //虚拟内存:[lbMemory]
                    lbMemory.Text = (Environment.WorkingSet / 1024).ToString() + "M";
                    //当前程序占用内存:[lbMemoryPro]
                    lbMemoryPro.Text = ((Double)GC.GetTotalMemory(false) / 1048576).ToString("N2") + "M";
                    //Asp.Net所占内存:[lbMemoryNet]
                    lbMemoryNet.Text = ((Double)Process.GetCurrentProcess().WorkingSet64 / 1048576).ToString("N2") + "M";
                    //Asp.Net所占CPU:[lbCpuNet]
                    lbCpuNet.Text = ((TimeSpan)Process.GetCurrentProcess().TotalProcessorTime).TotalSeconds.ToString("N0");
    
  • 相关阅读:
    极大似然估计理解与应用
    逻辑回归理解及代码实现
    《剑指offer》---数值的整数次方
    线性回归理解及代码实现
    二叉搜索树(BST)---python实现
    《剑指offer》---顺时针打印矩阵
    《剑指offer》---二进制中1的个数
    《剑指offer》---输出链表倒数第k个结点
    版本控制-Git服务器搭建和常用命令使用
    hbase伪分布式平台搭建(centos 6.3)
  • 原文地址:https://www.cnblogs.com/lookyou/p/1879160.html
Copyright © 2011-2022 走看看