Пример #1
0
        public SnmpWorkHost()
        {
            try
            {
                // SnmpWorkSettings を読み込む
                this.SettingsHive = new HiveData <SnmpWorkSettings>(Hive.SharedLocalConfigHive, $"SnmpWork", null, HiveSyncPolicy.AutoReadFromFile);

                // データベース
                this.InternalDbHive = new HiveData <SnmpWorkInternalDb>(Hive.SharedLocalConfigHive, "InternalDatabase/SnmpWorkInternalDb",
                                                                        getDefaultDataFunc: () => new SnmpWorkInternalDb(),
                                                                        policy: HiveSyncPolicy.AutoReadWriteFile,
                                                                        serializer: HiveSerializerSelection.RichJson);

                // HTTP サーバーを立ち上げる
                this.Cgi = new CgiHttpServer(new SnmpWorkCgiHandler(this), new HttpServerOptions()
                {
                    AutomaticRedirectToHttpsIfPossible = false,
                    DisableHiveBasedSetting            = true,
                    DenyRobots         = true,
                    UseGlobalCertVault = false,
                    LocalHostOnly      = true,
                    HttpPortsList      = new int[] { Settings.HttpPort }.ToList(),
                    HttpsPortsList     = new List <int>(),
                },
                                             true);
            }
            catch
            {
                this._DisposeSafe();
                throw;
            }
        }
Пример #2
0
 public static HttpServer <CgiHttpServerBuilder> StartServer(HttpServerOptions httpCfg, CgiHttpServer cgiHttpServer, CancellationToken cancel = default)
 => new HttpServer <CgiHttpServerBuilder>(httpCfg, cgiHttpServer, cancel);