AppDomain介绍
一、建立控制台项目
二、更改Program为ADSetp
三、去掉命名空间AppDomain.CurrentDomain
四、贴代码
using System;
using System.IO;
using System.Reflection;
using System.Security.Policy;
using System.Collections.Generic;
using System.Linq;
using System.Text; class ADSetup
{
public static void Main()
{
// Create application domain setup information
var domaininfo = new AppDomainSetup();
domaininfo.ConfigurationFile = System.Environment.CurrentDirectory +
Path.DirectorySeparatorChar +
"ADSetup.exe.config";
domaininfo.ApplicationBase = System.Environment.CurrentDirectory; //Create evidence for the new appdomain from evidence of the current application domain
Evidence adEvidence = AppDomain.CurrentDomain.Evidence; // Create appdomain
AppDomain domain = AppDomain.CreateDomain("Domain2", adEvidence, domaininfo); // Display application domain information.
Console.WriteLine("Host domain: " + AppDomain.CurrentDomain.FriendlyName);
Console.WriteLine("Child domain: " + domain.FriendlyName);
Console.WriteLine();
Console.WriteLine("Configuration file: " + domain.SetupInformation.ConfigurationFile);
Console.WriteLine("Application Base Directory: " + domain.BaseDirectory); AppDomain.Unload(domain); Console.ReadKey();
}
}
五、运行结果
Host domain: AppDomain.CurrentDomain.vshost.exe
Child domain: Domain2 Configuration file: c:\users\huqian\documents\visual studio \Projects\AppDomain.CurrentDomain\AppDomain.CurrentDomain\bin\Debug\ADSetup.exe.config
Application Base Directory: c:\users\huqian\documents\visual studio \Projects\AppDomain.CurrentDomain\AppDomain.CurrentDomain\bin\Debug
AppDomain介绍的更多相关文章
- AppDomain实现【插件式】开发
前言: 近期项目中需要实现"热插拔"式的插件程序,例如:定义一个插件接口:由不同开发人员实现具体的插件功能类库:并最终在应用中调用具体插件功能. 此时需要考虑:插件执行的安全性(隔 ...
- .Net环境下的缓存技术介绍 (转)
.Net环境下的缓存技术介绍 (转) 摘要:介绍缓存的基本概念和常用的缓存技术,给出了各种技术的实现机制的简单介绍和适用范围说明,以及设计缓存方案应该考虑的问题(共17页) 1 概念 ...
- c#多线程介绍(上)
转载原文:这里是链接内容 转载原文:这里写链接内容 转载原文:这里写链接内容 (重要事情说三遍) 引言 本文主要从线程的基础用法,CLR线程池当中工作者线程与I/O线程的开发,并行操作PLINQ等多个 ...
- .NET 新标准介绍
本文介绍如何使用 .NET 标准,更容易地实现向 .NET Core 迁移.文中会讨论计划包含的 APIs,跨构架兼容性如何工作以及这对 .NET Core 意味着什么. 如果你对细节感兴趣,这篇文章 ...
- .Net环境下的缓存技术介绍
.Net环境下的缓存技术介绍 摘要: 介绍缓存的基本概念和常用的缓存技术,给出了各种技术的实现机制的简单介绍和适用范围说明,以及设计缓存方案应该考虑的问题(共17页) 1 概念 1.1 ...
- WPF入门教程系列三——Application介绍(续)
接上文WPF入门教程系列二——Application介绍,我们继续来学习Application 三.WPF应用程序的关闭 WPF应用程序的关闭只有在应用程序的 Shutdown 方法被调用时,应用程序 ...
- Log4net 日志使用介绍
概述 Log4net 有三个主要组件:loggers,appenders 和 layouts.这三个组件一起工作使得开发者能够根据信息类型和等级(Level)记录信息,以及在运行时控制信息的格式化和信 ...
- 《介绍一款开源的类Excel电子表格软件》续:七牛云存储实战(C#)
两个月前的发布的博客<介绍一款开源的类Excel电子表格软件>引起了热议:在博客园有近2000个View.超过20个评论. 同时有热心读者电话咨询如何能够在SpreadDesing中实现存 ...
- 介绍 .NET Standard
作者:Vicey Wang 链接:https://zhuanlan.zhihu.com/p/24267356 原文:Introducing .NET Standard 作者:Immo Landwert ...
随机推荐
- 【leetcode】1258. Synonymous Sentences
题目如下: Given a list of pairs of equivalent words synonyms and a sentence text, Return all possible sy ...
- 【leetcode】1252. Cells with Odd Values in a Matrix
题目如下: Given n and m which are the dimensions of a matrix initialized by zeros and given an array ind ...
- (转)window.open和window.showModalDialog的区别
window.open和window.showModalDialog区别: 1.都是在IE上打开新窗口,只不过前者是非阻塞式,也可以说非模态窗口.而后者是阻塞式模态窗口.阻塞或者模态窗口,只有你把当前 ...
- 16位masm汇编实现记忆化递归搜索斐波那契数列第50项
.model small ;递归fib,使用压缩BCD码,小端派 .data y1 byte 6 dup(0) y2 byte 6 dup(0) vis byte 1,1,1,61 dup(0) ;便 ...
- Sonar页面Author页面展示
文主要记录通过Jenkins集成git .svn .sonarqube,获取源码后自动构建进行sonar scanner代码审查,并分析在sonar能够展示Author的原因. 一.Sonar通过je ...
- android 支持发送空短信
method:A) AP端修改:1.将ComposeMessageActivity.java 中的 isPreparedForSending() 作如下修改(删掉的code也可以注释掉)private ...
- Codeforces 798D Mike and distribution (构造)
题目链接 http://codeforces.com/contest/798/problem/D 题解 前几天的模拟赛,居然出这种智商题..被打爆了QAQ 这个的话,考虑只有一个序列怎么做,把所有的排 ...
- Apicloud_(问题)P54提示错误:Uncaught SyntaxError: Unexpected token ) at main.html : 117
<30天App开发从0到1:APICloud移动开发实战>第54页 打开main.html,在apiready中添加一段代码 api.addEventListener({ name: 'c ...
- mysql报错处理:incompatible with sql_mode=only_full_group_by
问题: 服务报错:incompatible with sql_mode=only_full_group_by,如下图所示: 分析: NLY_FULL_GROUP_BY是MySQL提供的一个sql_mo ...
- 通过Flink实现个推海量消息数据的实时统计
背景 消息报表主要用于统计消息任务的下发情况.比如,单条推送消息下发APP用户总量有多少,成功推送到手机的数量有多少,又有多少APP用户点击了弹窗通知并打开APP等.通过消息报表,我们可以很直观地看到 ...