• asp.net(c#) 服务器探针


    显示结果如下:

    计算机名:http://localhost/探针
    IP地址:127.0.0.1
    域名:localhost
    端口:1435
    本文件所在路径:E:\myaspx\探针\
    操作系统:Microsoft Windows NT 5.1.2600 Service Pack 2
    操作系统所在文件夹:C:\WINDOWS\system32
    脚本超时时间:0秒系统语言:Chinese (People's Republic of China)
    .NET版本:2.050727.42
    IE版本:6.0000
    启动到现在已运行:111分钟
    逻辑驱动器:C:\D:\E:\F:\G:\H:\
    CPU 数量:2
    CPU类型:x86 Family 15 Model 6 Stepping 5, GenuineIntel
    ASP.NET所站内存:31.60M
    ASP.NET所占CPU:3%
    当前系统用户名:nan

    代码如下(可直接复制到.aspx文件中使用):

    <%@ Page Language="C#"%>
    <%@ Import Namespace="System.Globalization"%>
    <%@ Import Namespace="Microsoft.Win32" %>
    <%@ Import Namespace="System.IO"%>
    <%@ Import Namespace="System.Diagnostics" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>asp.net 探针</title>
        <style type="text/css">
        body{font:12px tahoma;line-height:28px;background:black;color:white}
        </style>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
        <%
            //代码多有参考网络,可把代码直接复制到任何页面直接使用,代码为我所用,非我所想
            Response.Write("计算机名:");
            Response.Write("http://" + HttpContext.Current.Request.Url.Host + HttpContext.Current.Request.ApplicationPath + "<br />");
            Response.Write("IP地址:");
            Response.Write(Request.ServerVariables["LOCAl_ADDR"] + "<br />");
            Response.Write("域名:");
            Response.Write(Request.ServerVariables["SERVER_NAME"].ToString() + "<br />");
            Response.Write("端口:");
            Response.Write(Request.ServerVariables["Server_Port"].ToString() + "<br />");
            Response.Write("本文件所在路径:");
            Response.Write(Request.PhysicalApplicationPath + "<br />");
            Response.Write("操作系统:");
            Response.Write(Environment.OSVersion.ToString() + "<br />");
            Response.Write("操作系统所在文件夹:");
            Response.Write(Environment.SystemDirectory.ToString() + "<br />");
            Response.Write("脚本超时时间:");
            Response.Write((Server.ScriptTimeout / 1000).ToString() + "秒" + "<br />");
            Response.Write("系统语言:");
            Response.Write(CultureInfo.InstalledUICulture.EnglishName + "<br />");
            Response.Write(".NET版本:");
            Response.Write(string.Concat(new object[] { Environment.Version.Major, ".", Environment.Version.Minor, Environment.Version.Build, ".", Environment.Version.Revision }) + "<br />");
            Response.Write("IE版本:");
            RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Internet Explorer\Version Vector");
            Response.Write(key.GetValue("IE", "未检测到").ToString() + "<br />");
            Response.Write("启动到现在已运行:");
            Response.Write(((Environment.TickCount / 0x3e8) / 60).ToString() + "分钟" + "<br />");
            Response.Write("逻辑驱动器:");
            string[] achDrives = Directory.GetLogicalDrives();
            for (int i = 0; i < Directory.GetLogicalDrives().Length - 1; i++)
            {
                Response.Write(achDrives[i].ToString());
            }
            Response.Write("<br />");
            Response.Write("CPU 数量:");
            Response.Write(Environment.GetEnvironmentVariable("NUMBER_OF_PROCESSORS").ToString() + "<br />");
            Response.Write("CPU类型:");
            Response.Write(Environment.GetEnvironmentVariable("PROCESSOR_IDENTIFIER").ToString() + "<br />");
            Response.Write("ASP.NET所站内存:");
            Response.Write(((Double)Process.GetCurrentProcess().WorkingSet64 / 1048576).ToString("N2") + "M" + "<br />");
            Response.Write("ASP.NET所占CPU:");
            Response.Write(((TimeSpan)Process.GetCurrentProcess().TotalProcessorTime).TotalSeconds.ToString("N0") + "%<br />");
            Response.Write("当前系统用户名:");
            Response.Write(Environment.UserName + "<br />");
        %>
        </div>
        </form>
    </body>
    </html>

  • 相关阅读:
    线程池参数设置技巧
    线程池的七个参数
    bug篇——Windows启动redis报错Creating Server TCP listening socket 127.0.0.1:6379: bind: No error
    总结篇——git本地仓库上传更新到github
    实例篇——springboot自定义拦截器
    总结篇——从零搭建maven多模块springboot+mybatis项目
    bug篇——MySQL的时区问题
    工具类篇——时间处理Calendar类
    安装篇——nginx安装ssl模块转发https请求
    总结篇——nginx代理服务器
  • 原文地址:https://www.cnblogs.com/yhb199/p/1232589.html
Copyright © 2020-2023  润新知