using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.Hosting;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebApplication3
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Type hostType = typeof(Intelligencer);
string f = hostType.FullName;
Intelligencer intelligencer = System.Web.Hosting.ApplicationHost.CreateApplicationHost(hostType, "/", Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "bin")) as Intelligencer;//方法按照以下顺序寻找hostType定义:1.GAC,2.网站物理文件目录Bin文件夹下,如果没有加到GAC中的话,在网站应用程序下创建Bin文件夹,然后将程序集放入。
ltl1.Text += string.Format("Current Domain ID: {0} <br>", AppDomain.CurrentDomain.Id);
ltl1.Text += string.Format("Virtual Path: {0} <br>", HostingEnvironment.ApplicationVirtualPath);
ltl1.Text += string.Format("Physcical Path: {0} <br>", HostingEnvironment.ApplicationPhysicalPath);
}
}
public class Intelligencer : System.MarshalByRefObject
{
}
}