Exemplo n.º 1
0
 public ServerInfo(IProcessManagerSync pm, IPEndPoint http, IPEndPoint https) {
     IsHttpPortRegistered = (http != null) && QueryPortRegistered(pm, http.ToHttp());
     IsHttpsPortRegistered = (https != null) && QueryPortRegistered(pm, https.ToHttps());
     IsCertRegistered = QueryCertRegistered(pm, https);
     MainLog.Logger.Info(
         $"HttpRegistered: {IsHttpPortRegistered} ({http}), HttpsRegistered: {IsHttpsPortRegistered} ({https}), CertRegistered: {IsCertRegistered}");
 }
 private static List<string> BuildUrls(IPEndPoint http, IPEndPoint https) {
     var urls = new List<string>();
     if ((http == null) && (https == null))
         throw new CannotOpenApiPortException("No HTTP or HTTPS ports available");
     if (http != null)
         urls.Add(http.ToHttp());
     if (https != null)
         urls.Add(https.ToHttps());
     return urls;
 }
Exemplo n.º 3
0
        public virtual Task Run(IPEndPoint http, IPEndPoint https, CancellationToken cancelToken) {
            var hostBuilder = new WebHostBuilder();
            //        .UseContentRoot(Directory.GetCurrentDirectory())
            ConfigureBuilder(hostBuilder);

            var urls = new List<string>();
            if ((http == null) && (https == null))
                throw new CannotOpenApiPortException("No HTTP or HTTPS ports available");
            if (http != null)
                urls.Add(http.ToHttp());
            if (https != null)
                urls.Add(https.ToHttps());
            hostBuilder.UseUrls(urls.ToArray());
            var webHost = hostBuilder.Build();
            return TaskExt.StartLongRunningTask(() => webHost.Run(cancelToken), cancelToken);
        }