当前位置: 首页 > 图文教程 > 网络编程 > ASP.NET > 查看主机的内存使用情况

ASP.NET
LinQ学习之旅 从整型数组中找出偶数
解析:如何在 ASP.NET 中下载文件
无废话C#设计模式之九:Proxy
Asp.net中实现从弹出窗口中选择值
.Net中给TreeView控件的节点赋id值
ASP.NET 清除 HTML 标记函数
C#之 VS2008 之 Extension Methods
通过 C# 简化 APM
.Net调用Java webservice访问被拒绝解决方案
C#学习之类的访问修饰符
ASP.NET AJAX中的异步Web Services调用
.Net中生成二维的表格的代码
C#中的两个+(plus)操作符解析
Asp.net 2.0的TreeView客户端个性化控制
直接访问WebBrowser控件中的HTML源码
ASP.NET AJAX中的非同步PageMethod调用
利用C#实现分布式数据库查询
Web Services开发体会和在项目中的教训
开发学习之.Net中PE文件的结构
用C#实现启动另一程序的方法

ASP.NET 中的 查看主机的内存使用情况


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 73 ::
收藏到网摘: n/a

http://www.asp888.net 豆腐技术站

这个是我在国外的一个站点上看到的使用Asp.Net得到一些系统变量的程序,
大家可以看看,其实这个程序没有多大的用处,只是说明一下asp.Net 的强大功能而已。
<script language="C#" runat=server>
void Page_Load(Object sender, EventArgs ev)
{
ProcessInfo[] history = ProcessModelInfo.GetHistory(100);
for( int i=0; i<history.Length; i++ )
{
Response.Write("StartTime:"+ history[i].StartTime.ToString() + "<BR>");
Response.Write("Age:" + history[i].Age.ToString() + "<BR>");
Response.Write("ProcessID:" + history[i].ProcessID.ToString() + "<BR>");
Response.Write("RequestCount:" + history[i].RequestCount.ToString() + "<BR>");
Response.Write("Status:" + GetProcessStatus(history[i].Status ) + "<BR>");
Response.Write("ShutdownReason:" + GetShutdownReason(history[i].ShutdownReason) + "<BR>");
Response.Write("PeakMemoryUsed:" + history[i].PeakMemoryUsed.ToString() + "<BR>");

}
}

public String GetProcessStatus( ProcessStatus ps )
{
String s = "Unknown";
if( ps == ProcessStatus.Alive )
s = "Alive";
else if( ps == ProcessStatus.ShuttingDown )
s = "Shutting Down";
else if( ps == ProcessStatus.ShutDown )
s = "Shutdown";
else if( ps == ProcessStatus.Terminated )
s = "Terminated";
return s;
}

public String GetShutdownReason( ProcessShutdownReason psr )
{
String s = "Unknown";
if( psr == ProcessShutdownReason.None )
s = "N/A";
else if( psr == ProcessShutdownReason.Unexpected )
s = "Unexpected";
else if( psr == ProcessShutdownReason.RequestsLimit )
s = "Requests Limit";
else if( psr == ProcessShutdownReason.RequestQueueLimit )
s = "Request Queue Limit";
else if( psr == ProcessShutdownReason.Timeout )
s = "Timeout";
else if( psr == ProcessShutdownReason.IdleTimeout )
s = "Idle Timeout";
else if( psr == ProcessShutdownReason.MemoryLimitExceeded )
s = "Memory Limit Exceeded";
return s;
}
</script>