/// <summary> /// 调用该方法时为远程调用,已经在 新建的 AppDomain 里面了。 /// 与主上下文不一致,日志等全局配置失效。 /// </summary> /// <param name="codes"></param> public void Start(byte[] codes, string root) { DynLogger.Init(".s.log", root); "DynLibrarian.Start".Log(); Assembly dynAssembly = AppDomain.CurrentDomain.Load(codes); dynWorker = dynAssembly.CreateInstance(DynWorkerName); Invoke("Init", root); Invoke("Start"); }
/// <summary> /// 应用程序的主入口点。 /// </summary> static void Main() { try { DynLogger.Init(); ServiceBase[] ServicesToRun; ServicesToRun = new ServiceBase[] { new DynService() }; ServiceBase.Run(ServicesToRun); } finally { DynLogger.Quit(); } }