zoukankan      html  css  js  c++  java
  • 应用程序域(Application Domain)

    应用程序域为隔离正在运行的应用程序提供了一种灵活而安全的方法。

    应用程序域通常由运行时宿主创建和操作。 有时,您可能希望应用程序以编程方式与应用程序域交互,例如想在不停止应用程序运行的情况下卸载某个组件时。

    应用程序域使应用程序以及应用程序的数据彼此分离,有助于提高安全性。 单个进程可以运行多个应用程序域,并具有在单独进程中所存在的隔离级别。 在单个进程中运行多个应用程序提高了服务器伸缩性。

    下面的代码示例创建一个新的应用程序域,然后加载并执行以前生成的程序集 HelloWorld.exe,该程序集存储在驱动器 C 上。

    // Create an Application Domain:
    System.AppDomain newDomain = System.AppDomain.CreateDomain("NewApplicationDomain");
    
    // Load and execute an assembly:
    newDomain.ExecuteAssembly(@"c:HelloWorld.exe");
    
    // Unload the application domain:
    System.AppDomain.Unload(newDomain);

    应用程序域具有以下特点:

    • 必须先将程序集加载到应用程序域中,然后才能执行该程序集。

    • 一个应用程序域中的错误不会影响在另一个应用程序域中运行的其他代码。

    • 能够在不停止整个进程的情况下停止单个应用程序并卸载代码。 不能卸载单独的程序集或类型,只能卸载整个应用程序域。

  • 相关阅读:
    hud 1166 敌兵布阵
    zznu 1914 asd的甩锅计划
    poj 1860 Currency Exchange
    poj 3026 Borg Maze (BFS + Prim)
    poj 2349 Arctic Network
    POJ 1502 MPI Maelstrom
    poj 1308 Is It A Tree?
    hdu 1272 小希的迷宫
    poj 1679 http://poj.org/problem?id=1679
    POJ 2492 A Bug's Life
  • 原文地址:https://www.cnblogs.com/chenyongblog/p/3999023.html
Copyright © 2011-2022 走看看