zoukankan      html  css  js  c++  java
  • C#如何配置应用程序域

    转载:http://www.csharpwin.com/csharpspace/9175r9023.shtml

    您可以使用 AppDomainSetup 类,为新应用程序域提供带有配置信息的公共语言运行库。创建自己的应用程序域时,最重要的属性是 ApplicationBase。其他 AppDomainSetup 属性主要由运行时宿主用于配置特殊的应用程序域。

    ApplicationBase 属性定义应用程序的根目录,当运行时需要满足类型请求时,它在 ApplicationBase 属性指定的目录中探测包含该类型的程序集。

    注意

    新的应用程序域只继承创建者的 ApplicationBase 属性。

    下面的示例创建 AppDomainSetup 类的实例,此类用于创建新的应用程序域,将信息写入控制台,然后卸载应用程序域。

       1:  using System;
       2:  using System.Reflection;
       3:  class AppDomain4
       4:  {
       5:      public static void Main()
       6:      {
       7:          // Create application domain setup information.
       8:          AppDomainSetup domaininfo = new AppDomainSetup();
       9:          domaininfo.ApplicationBase = "F:\work";
      10:   
      11:          // Create the application domain.
      12:          AppDomain domain = AppDomain.CreateDomain("MyDomain", null, domaininfo);
      13:   
      14:          // Write application domain information to the console.
      15:          Console.WriteLine("Host domain: " + AppDomain.CurrentDomain.FriendlyName);
      16:          Console.WriteLine("child domain: " + domain.FriendlyName);
      17:          Console.WriteLine("Application base is: " + domain.SetupInformation.ApplicationBase);
      18:   
      19:          // Unload the application domain.
      20:          AppDomain.Unload(domain);
      21:          Console.ReadLine();
      22:      }
      23:  }
  • 相关阅读:
    python面向对象三大特性之一封装
    python面向对象的三大特性之一多态
    python之子类调用父类的两种方式
    python之接口继承
    python之组合与继承的使用场景
    Learning to Rank Short Text Pairs with Convolutional Deep Neural Networks(paper)
    lesson9-小象学院cv
    tips
    C5-fasterrcnn-小象cv-code
    C4-ResNet-TF-小象cv-code
  • 原文地址:https://www.cnblogs.com/zhaox583132460/p/3444982.html
Copyright © 2011-2022 走看看