ASP.NET 服务器参数、路径等

简介:
using System;
using System.Globalization;
using System.Web.UI;

namespace WebApplication1
{
    public partial class _Default : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string test = "";
            test += "Request.ServerVariables[\"LOCAL_ADDR\"]:" + Request.ServerVariables["LOCAL_ADDR"] + "<br/>"; //服务器IP地址
            test += "Request.ServerVariables[\"SERVER_NAME\"]:" + Request.ServerVariables["SERVER_NAME"] + "<br/>"; //服务器域名 
            test += "Request.ServerVariables[\"SERVER_SOFTWARE\"]:" + Request.ServerVariables["SERVER_SOFTWARE"] + "<br/>"; //服务器IIS版本
            test += "Request.ServerVariables[\"SERVER_PORT\"]:" + Request.ServerVariables["SERVER_PORT"] + "<br/>"; //HTTP访问端口
            test += "Request.ServerVariables[\"APPL_RHYSICAL_PATH\"]:" + Request.ServerVariables["APPL_RHYSICAL_PATH"] + "<br/>"; //虚拟目录的绝对路径
            test += "Request.ServerVariables[\"PATH_TRANSLATED\"] :" + Request.ServerVariables["PATH_TRANSLATED"] + "<br/>"; //执行文件的绝对路径
            test += "Request.ServerVariables[\"HTTP_HOST\"]:" + Request.ServerVariables["HTTP_HOST"] + "<br/>"; //域名主机
            test += "Request.ServerVariables[\"HTTP_ACCEPT_LANGUAGE\"]:" + Request.ServerVariables["HTTP_ACCEPT_LANGUAGE"] + "<br/>"; //服务器区域语言
            test += "Request.ServerVariables[\"HTTP_USER_AGENT\"]:" + Request.ServerVariables["HTTP_USER_AGENT"] + "<br/>";

            test += "<br/>";

            test += "Request.ApplicationPath: " + Request.ApplicationPath + "<br/>";
            test += "Request.CurrentExecutionFilePath:" + Request.CurrentExecutionFilePath + "<br/>";
            test += "Request.FilePath:" + Request.FilePath + "<br/>";
            test += "Request.Path:" + Request.Path + "<br/>";
            test += "Request.PhysicalApplicationPath:" + Request.PhysicalApplicationPath + "<br/>";
            test += "Request.RawUrl:" + Request.PhysicalApplicationPath + "<br/>";
            test += "Request.Url.AbsolutePath: " + Request.PhysicalApplicationPath + "<br/>";
            test += "Request.Url.AbsoluteUri:" + Request.PhysicalApplicationPath + "<br/>";
            test += "Request.Url.Host:" + Request.PhysicalApplicationPath + "<br/>";
            test += "Request.Url.LocalPath:" + Request.PhysicalApplicationPath + "<br/>";
            test += "Request.Url.LocalPath:" + Request.PhysicalApplicationPath + "<br/>";

            test += "<br/>";

            test += "服务器名称:" + Server.MachineName + "<br/>"; //服务器名称
            test += "CPU个数:" + Environment.GetEnvironmentVariable("NUMBER_OF_PROCESSORS") + "<br/>"; //CPU个数
            test += "CPU类型:" + Environment.GetEnvironmentVariable("PROCESSOR_IDENTIFIER") + "<br/>"; //CPU类型
            test += "虚拟目录Session总数:" + Session.Contents.Count.ToString(CultureInfo.InvariantCulture) + "<br/>"; //虚拟目录Session总数
            test += "虚拟目录Application总数:" + Application.Contents.Count.ToString(CultureInfo.InvariantCulture) + "<br/>";//虚拟目录Application总数         
            test += ".NET解释引擎版本:" + ".NET CLR" + Environment.Version.Major + "." + Environment.Version.Minor + "." + Environment.Version.Build + "." + Environment.Version.Revision + "<br/>"; //.NET解释引擎版本
            test += "服务器操作系统版本:" + Environment.OSVersion + "<br/>"; //服务器操作系统版本



            Response.Write(test);
        }
    }
}

输出结果:


目录
相关文章
|
2月前
|
网络协议 Shell 网络安全
实验目的1.编译安装httpd2.优化路径3.并将鲜花网站上传到web服务器为网页目录4.在客户机访问网站http://www.bdqn.com
实验目的1.编译安装httpd2.优化路径3.并将鲜花网站上传到web服务器为网页目录4.在客户机访问网站http://www.bdqn.com
166 0
|
4月前
|
开发框架 安全 .NET
IIS服务器发布ASP.NET项目
对于云服务器,程序员一般不会陌生,如果项目需要发布到现网,那么服务器是必不可缺的一项硬性条件,那么如何在云服务器上部署一个项目,需要做哪些配置准备,下面就由本文档为大家讲解,本篇以IIS服务器发布ASP.NET项目为例。
49 1
|
3月前
|
弹性计算 Ubuntu Linux
2024年幻兽帕鲁一键搭建服务器+一键参数设置教程
《幻兽帕鲁》这款游戏是适合多年龄段玩家进行游玩的,小伙伴们一个人玩会感觉很无聊那不妨喊上自己的好朋友们一起来玩,在这款游戏中小伙伴们需要在广袤的地图上搜寻属于自己的“帕鲁”,培养他们进行创造、战斗、制作等,帮助你创造属于自己的家园。这款游戏目前还是十分火爆的那么本期就来讲讲幻兽帕鲁服务器搭建教程。
141 1
|
4月前
|
弹性计算 Ubuntu Linux
【幻兽帕鲁Palworld】搭建服务器配置参数说明,附阿里云幻兽帕鲁服务器搭建教程
创建幻兽帕鲁服务器配置参数说明,Palworld服务器配置参数与解释:
613 0
|
5月前
|
缓存 关系型数据库 MySQL
MySQL调优之服务器参数优化实践
MySQL调优之服务器参数优化实践
355 0
|
2月前
|
弹性计算 缓存 数据库
阿里云服务器2核4G配置租用价格表_2核4G性能参数说明
阿里云服务器2核4G配置租用价格表_2核4G性能参数说明,2核4G配置1个月多少钱?2核4G服务器30元3个月、轻量应用服务器2核4G4M带宽165元一年、企业用户2核4G5M带宽199元一年
|
3月前
|
机器学习/深度学习 存储 编解码
多任务学习新篇章 | EMA-Net利用Cross-Task Affinity实现参数高效的高性能预测
多任务学习新篇章 | EMA-Net利用Cross-Task Affinity实现参数高效的高性能预测
46 0
|
3月前
|
定位技术 数据安全/隐私保护
幻兽帕鲁服务器参数配置指南&参数解读&参数推荐
幻兽帕鲁服务器支持非常多的参数配置,本文带来了详细的参数解读、配置教程,以及亲身体验后的参数搭配,大幅增加你的游戏体验!
|
3月前
|
弹性计算 Linux 数据安全/隐私保护
零门槛!幻兽帕鲁服务器搭建与服务器参数修改教程
零门槛!幻兽帕鲁服务器搭建与服务器参数修改教程
168 1
零门槛!幻兽帕鲁服务器搭建与服务器参数修改教程
|
3月前
|
弹性计算 定位技术
幻兽帕鲁服务器配置参数汉化说明
创建幻兽帕鲁服务器配置参数说明,Palworld服务器配置参数与解释,阿里云百科分享
416 0