/// <summary> /// 本地模式 /// </summary> /// <typeparam name="domainServerType"></typeparam> /// <param name="workPath"></param> /// <param name="log"></param> /// <param name="hosts"></param> /// <returns></returns> public static Server Create <domainServerType>(string workPath, ILog log, params HostPort[] hosts) where domainServerType : HttpDomainServer.Server { Server server = new Server(); RegisterState state = RegisterState.Unknown; try { if ((state = server.start <domainServerType>(workPath, hosts, log)) == RegisterState.Success) { return(server); } AutoCSer.Log.Pub.Log.Add(AutoCSer.Log.LogType.Debug, "HTTP服务启动失败 " + state.ToString()); } finally { if (state != RegisterState.Success) { server.Dispose(); } } return(null); }
/// <summary> /// 本地模式 /// </summary> /// <typeparam name="domainServerType"></typeparam> /// <param name="workPath"></param> /// <param name="log"></param> /// <param name="domains"></param> /// <returns></returns> public static Server Create <domainServerType>(string workPath, ILog log, params Domain[] domains) where domainServerType : HttpDomainServer.Server { Server server = new Server(); RegisterState state = RegisterState.Unknown; try { if ((state = server.start <domainServerType>(workPath, domains, log)) == RegisterState.Success) { return(server); } AutoCSer.LogHelper.Debug("HTTP服务启动失败 " + state.ToString(), LogLevel.Debug | LogLevel.AutoCSer); } finally { if (state != RegisterState.Success) { server.Dispose(); } } return(null); }