应用程序域
一.什么是应用程序域?
二.什么时候用应用程序域?
在一个应用程序中出现的错误不会影响其他应用程序。因为类型安全的代码不会导致内存错误,所以使用应用程序域可以确保在一个域中运行的代码不会影响进程中的其他应用程序。
能够在不停止整个进程的情况下停止单个应用程序。使用应用程序域使您可以卸载在单个应用程序中运行的代码。
注意 不能卸载单个程序集或类型。只能卸载整个域。
三.应用程序域的简单实例?
SetupInfo设置程序域的信息
1 [Serializable] 2 public class SetupInfo : MarshalByRefObject 3 { 4 /// <summary>应用程序域id</summary> 5 public string Id { get; set; } 6 7 /// <summary>应用目录</summary> 8 public string BinaryDirectory { get; set; } 9 10 /// <summary>应用父目录</summary> 11 public string BaseDirectory { get; set; } 12 13 /// <summary>应用入点</summary> 14 public string EntryPoint { get; set; } 15 }