06-Web应用程序的运行时
来源:互联网 发布:人工智能 西蒙 编辑:程序博客网 时间:2024/05/21 17:14
using System.Web;
using System.Web.Hosting;
namespace _06_Web应用程序的运行时
{
class Intelligencer : System.MarshalByRefObject
{
public string GetHostingEncironmentInfo()
{
System.AppDomain appdomain = System.AppDomain.CurrentDomain;
StringBuilder builder = new StringBuilder();
//应用程序域的信息
builder.AppendFormat("Domain ID:{0}\r\n",appdomain.Id);
//对于每一个Web应用程序域,有一个HostingEnvironment
builder.AppendFormat("VirrtualPath:{0}\r\n", HostingEnvironment.ApplicationVirtualPath);
builder.AppendFormat("PhysicalPath:{0}\r\n",HostingEnvironment.ApplicationPhysicalPath);
return builder.ToString();
}
public string GetHttpRuntimeInfo()
{
StringBuilder builder = new StringBuilder();
// 每个 Web 应用程序域中,有一个 HttpRuntime
builder.AppendFormat("AppDomainAppId: {0}\r\n",
HttpRuntime.AppDomainAppId);
builder.AppendFormat("AppDomainAppPath: {0}\r\n",
HttpRuntime.AppDomainAppPath);
builder.AppendFormat("AppDomainAppVirtualPath: {0}\r\n",
HttpRuntime.AppDomainAppVirtualPath);
builder.AppendFormat("AspClientScriptVirtualPath: {0}\r\n",
HttpRuntime.AspClientScriptVirtualPath);
builder.AppendFormat("AspClientScriptPhysicalPath: {0}\r\n",
HttpRuntime.AspClientScriptPhysicalPath);
builder.AppendFormat("AppDomainId: {0}\r\n",
HttpRuntime.AppDomainId);
builder.AppendFormat("AspInstallDirectory: {0}\r\n",
HttpRuntime.AspInstallDirectory);
builder.AppendFormat("BinDirectory: {0}\r\n",
HttpRuntime.BinDirectory);
builder.AppendFormat("ClrInstallDirectory: {0}\r\n",
HttpRuntime.ClrInstallDirectory);
builder.AppendFormat("CodegenDir: {0}\r\n",
HttpRuntime.CodegenDir);
builder.AppendFormat("IsOnUNCShare: {0}\r\n",
HttpRuntime.IsOnUNCShare.ToString());
builder.AppendFormat("MachineConfigurationDirectory: {0}\r\n",
HttpRuntime.MachineConfigurationDirectory);
builder.AppendFormat("UsingIntegratedPipeline: {0}\r\n",
HttpRuntime.UsingIntegratedPipeline);
return builder.ToString();
}
}
}
//调用该类
using System;
namespace _06_Web应用程序的运行时
{
class Program
{
static void Main(string[] args)
{
System.Type hostType = typeof(Intelligencer);
Intelligencer intelligencer = System.Web.Hosting.ApplicationHost.CreateApplicationHost(
hostType,
"/",
System.Environment.CurrentDirectory
)
as Intelligencer;
Console.WriteLine("Current Domain ID:{0}", AppDomain.CurrentDomain.Id);
Console.WriteLine();
Console.WriteLine(intelligencer.GetHostingEncironmentInfo());
Console.WriteLine();
Console.WriteLine(intelligencer.GetHttpRuntimeInfo());
Console.Read();
}
}
}
- 06-Web应用程序的运行时
- 运行时的 Web 应用程序安全性
- Web上运行应用程序的一个方法
- linux 运行java非web的应用程序
- weblogic eclipse 运行web应用程序
- 笔记--Tomcat运行web应用程序
- RadRails中运行 原有的Rails Web应用程序
- 运行MapXtreme的Web应用程序报错; COM+ 激活方法!
- 了解 Web 应用程序的运行方式以及如何提高性能
- 部署并运行你的OSGi Web应用程序
- 运行MapXtreme的Web应用程序报错; COM+ 激活方法!
- 部署并运行你的OSGi Web应用程序
- 将开发目录配置成web应用程序运行的目录
- 当不可信小应用程序或应用程序在 Web 浏览器中运行时,我应当如何控制?
- 关于建立asp.net WEB应用程序时,提示IIS运行的不是asp.net 1.1版的解决办法
- 无法运行asp.net web应用程序 (转载)
- VS中无法运行WEB应用程序
- GWT应用程序运行方式(Hosted | Web)Model
- OpenGL 学习笔记
- 二叉树
- android 调用webservice 接口
- 完全解析斐波那契数列
- [小知识] grep中如何使用正则表达式匹配数字
- 06-Web应用程序的运行时
- 顺序表的删除1
- Hadoop实战教程视频
- Linux查看CPU和内存使用情况
- php 显示错误回显
- Busybox下tftp命令使用详解
- C语言getopt()函数的使用
- shell脚本中自动输入用户名和密码
- while 的用法