public CertificateFactory( TermsOfServiceChecker tosChecker, IOptions <LetsEncryptOptions> options, IHttpChallengeResponseStore challengeStore, IAccountStore?accountRepository, ILogger logger, IHostEnvironment env, IHostApplicationLifetime appLifetime, TlsAlpnChallengeResponder tlsAlpnChallengeResponder) { _tosChecker = tosChecker; _options = options; _challengeStore = challengeStore; _logger = logger; _tlsAlpnChallengeResponder = tlsAlpnChallengeResponder; _appStarted = new TaskCompletionSource <object?>(); appLifetime.ApplicationStarted.Register(() => _appStarted.TrySetResult(null)); if (appLifetime.ApplicationStarted.IsCancellationRequested) { _appStarted.TrySetResult(null); } _accountRepository = accountRepository ?? new FileSystemAccountStore(logger, options, env); AcmeServer = _options.Value.GetAcmeServer(env); }
public AcmeCertificateFactory( AcmeClientFactory acmeClientFactory, TermsOfServiceChecker tosChecker, IOptions <LettuceEncryptOptions> options, IHttpChallengeResponseStore challengeStore, IAccountStore?accountRepository, ILogger <AcmeCertificateFactory> logger, IHostApplicationLifetime appLifetime, ICertificateAuthorityConfiguration certificateAuthority) { _acmeClientFactory = acmeClientFactory; _tosChecker = tosChecker; _options = options; _challengeStore = challengeStore; _logger = logger; _appStarted = new TaskCompletionSource <object?>(); appLifetime.ApplicationStarted.Register(() => _appStarted.TrySetResult(null)); if (appLifetime.ApplicationStarted.IsCancellationRequested) { _appStarted.TrySetResult(null); } _accountRepository = accountRepository ?? new FileSystemAccountStore(logger, certificateAuthority); }
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IAmqpService amqpService, IApplicationLifetime applicationLifetime) { if (_hostingEnvironment.IsDevelopment() || _hostingEnvironment.IsEnvironment("DevelopmentServer")) { app.UseDeveloperExceptionPage(); } loggerFactory.AddConsole(Configuration.GetSection("Logging")); //loggerFactory.AddDebug(); loggerFactory.AddLog4Net(Path.Combine(ContentRoot, "config/log4net.config")); app.UseMvc(); app.UseSwagger(); app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", "SmartDevicesGatewayAPI"); }); //using (var serviceScope = app.ApplicationServices.GetRequiredService<IServiceScopeFactory>().CreateScope()) //{ // var dbContext = serviceScope.ServiceProvider.GetService<SmartdevicesGatewayDBContext>(); // var dbNewlyCreated = dbContext.Database.EnsureCreated(); //} applicationLifetime.ApplicationStarted.Register(OnStarted); applicationLifetime.ApplicationStopping.Register(OnShutdown); _app = app; }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IApplicationLifetime lifetime) { app.UseSwagger(); app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", AppName + "V1"); c.RoutePrefix = "help"; }); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseStaticFiles() .UseRouting() .UseAuthorization() .UseEndpoints(endpoints => { endpoints.MapControllers(); endpoints.MapHub <EchoHub>("/echo"); }); lifetime.ApplicationStarted.Register(() => { TestAkka.Start(app, actorSystem); }); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. #pragma warning disable CS0618 // 类型或成员已过时 public void Configure(IApplicationBuilder app, IWebHostEnvironment env, Microsoft.Extensions.Hosting.IApplicationLifetime lifetime, ILoggerFactory loggerFactory) #pragma warning restore CS0618 // 类型或成员已过时 { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } CompanyDbContext companyDbContext = app.ApplicationServices.GetService <CompanyDbContext>(); // companyDbContext.Database.EnsureDeleted(); if (companyDbContext.Database.EnsureCreated()) { } app.UseStaticFiles(); app.UseAuthorization(); lifetime.ApplicationStarted.Register(() => { app.RegisterConsul(Configuration); app.RegisterZipkin(loggerFactory, lifetime, Configuration); }); lifetime.ApplicationStopped.Register(() => { app.StopConsul(); app.StopZipkin(); }); app.Use(env, "Company API V1"); }
public AcmeCertificateLoader( CertificateSelector selector, IHttpChallengeResponseStore challengeStore, IOptions <LetsEncryptOptions> options, ILogger <AcmeCertificateLoader> logger, IHostEnvironment hostEnvironment, IServer server, IConfiguration config, TermsOfServiceChecker tosChecker, IEnumerable <ICertificateRepository> certificateRepositories, IClock clock, IHostApplicationLifetime applicationLifetime, TlsAlpnChallengeResponder tlsAlpnChallengeResponder, IAccountStore?accountStore = default) { _selector = selector; _challengeStore = challengeStore; _accountStore = accountStore; _options = options; _logger = logger; _hostEnvironment = hostEnvironment; _server = server; _config = config; _tosChecker = tosChecker; _certificateRepositories = certificateRepositories; _clock = clock; _applicationLifetime = applicationLifetime; _tlsAlpnChallengeResponder = tlsAlpnChallengeResponder; }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IApplicationLifetime lifetime) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Home/Error"); // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } lifetime.ApplicationStarted.Register(() => RegisterSignalRWithRabbitMQ(app.ApplicationServices)); app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllerRoute( name: "default", pattern: "{controller=Home}/{action=Index}/{id?}"); endpoints.MapHub <StockChannelHub>($"/{StockChannelHub.HubName}"); }); app.UseAuthentication(); }
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IApplicationLifetime applicationLifetime) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseSwagger(); // Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.), // specifying the Swagger JSON endpoint. app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", "TestApp API V1"); }); app.UseHttpsRedirection(); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); applicationLifetime.ApplicationStopping.Register(OnShutdown); }
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, Microsoft.Extensions.Hosting.IApplicationLifetime appLifetime) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } //使用Serilog日志 app.UseSerilogRequestLogging(); // 添加Swagger有关中间件 app.UseSwagger(); app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", "API Demo v1"); }); //启用验证 app.UseAuthentication(); app.UseAuthorization(); app.UseSession(); //设置启始页 DefaultFilesOptions defaultFilesOptions = new DefaultFilesOptions(); defaultFilesOptions.DefaultFileNames.Clear(); defaultFilesOptions.DefaultFileNames.Add("htmlpage.html"); app.UseDefaultFiles(defaultFilesOptions); app.UseStaticFiles(); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); //获取前面注入的Quartz调度类 var quartz = app.ApplicationServices.GetRequiredService <QuartzStartup>(); appLifetime.ApplicationStarted.Register(() => { quartz.Start().Wait(); //网站启动完成执行 }); appLifetime.ApplicationStopped.Register(() => { quartz.Stop(); //网站停止完成执行 }); }
public void Configure(IApplicationBuilder app, Microsoft.Extensions.Hosting.IApplicationLifetime lifetime) { lifetime.ApplicationStarted.Register(() => System.Console.WriteLine("===== Server is starting")); lifetime.ApplicationStopping.Register(() => System.Console.WriteLine("===== Server is stopping")); lifetime.ApplicationStopped.Register(() => System.Console.WriteLine("===== Server has stopped")); app.Run(async context => { await context.Response.WriteAsync("Hello world"); }); }
public NBXplorerListener(ExplorerClientProvider explorerClients, BTCPayWalletProvider wallets, InvoiceRepository invoiceRepository, EventAggregator aggregator, Microsoft.Extensions.Hosting.IApplicationLifetime lifetime) { PollInterval = TimeSpan.FromMinutes(1.0); _Wallets = wallets; _InvoiceRepository = invoiceRepository; _ExplorerClients = explorerClients; _Aggregator = aggregator; _Lifetime = lifetime; }
public void Configure( IApplicationBuilder app, IApplicationLifetime lifetime, IBrowserLauncher browserLauncher, IDirectoryAccessor directoryAccessor, PackageRegistry packageRegistry) { using (var operation = Log.OnEnterAndConfirmOnExit()) { lifetime.ApplicationStopping.Register(() => _disposables.Dispose()); ConfigureForOrchestratorProxy(app); app.Map("/LocalCodeRunner/blazor-console", builder => { builder.UsePathBase("/LocalCodeRunner/blazor-console/"); builder.EnableCachingBlazorContent(); builder.UseBlazor <MLS.Blazor.Program>(); }); app.Map("/LocalCodeRunner/humanizer.api", builder => { builder.UsePathBase("/LocalCodeRunner/humanizer/"); builder.EnableCachingBlazorContent(); builder.UseBlazor <MLS.HumanizerRunner.Program>(); }); var budget = new Budget(); _disposables.Add(() => budget.Cancel()); BlazorPackageConfiguration.Configure(app, app.ApplicationServices, packageRegistry, budget, !StartupOptions.IsLanguageService); app.UseDefaultFiles() .UseStaticFilesFromToolLocation() .UseRouter(new StaticFilesProxyRouter()) .UseMvc(); operation.Succeed(); if (StartupOptions.Mode == StartupMode.Try) { Clock.Current .Schedule(_ => LaunchBrowser(browserLauncher, directoryAccessor), TimeSpan.FromSeconds(1)); } } }
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IApplicationLifetime lifetime) { app.UseSwagger(); app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", AppName + "V1"); c.RoutePrefix = "help"; }); if (!env.IsProduction()) { using (var serviceScope = app.ApplicationServices.GetService <IServiceScopeFactory>().CreateScope()) { //로컬 개발모드에서는 Entity 자동생성 var userRepository = serviceScope.ServiceProvider.GetRequiredService <UserRepository>(); string currentConection = userRepository.Database.GetDbConnection().ConnectionString; if (currentConection.Contains("localhost")) { //userRepository.Database.EnsureDeleted(); //userRepository.Database.EnsureCreated(); } // ORM 마이그레이션은 다음을 참고합니다. // https://docs.microsoft.com/ko-kr/ef/core/managing-schemas/migrations/?tabs=dotnet-core-cli } app.UseDeveloperExceptionPage(); } app.UseStaticFiles() .UseRouting() .UseAuthorization() .UseEndpoints(endpoints => { endpoints.MapControllers(); endpoints.MapHub <EchoHub>("/echo"); }); lifetime.ApplicationStarted.Register(() => { TestAkka.Start(app, actorSystem); }); }
public InvocationLifetime( IOptions <InvocationLifetimeOptions> options, IHostEnvironment environment, IHostApplicationLifetime applicationLifetime, InvocationContext context = null, ILoggerFactory loggerFactory = null) { Options = options?.Value ?? throw new ArgumentNullException(nameof(options)); Environment = environment ?? throw new ArgumentNullException(nameof(environment)); ApplicationLifetime = applicationLifetime ?? throw new ArgumentNullException(nameof(applicationLifetime)); // if InvocationLifetime is added outside of a System.CommandLine // invocation pipeline context will be null. // Use default cancellation token instead, and become a noop lifetime. invokeCancelToken = context?.GetCancellationToken() ?? default; Logger = (loggerFactory ?? NullLoggerFactory.Instance) .CreateLogger("Microsoft.Hosting.Lifetime"); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. #pragma warning disable CS0618 // 类型或成员已过时 public void Configure(IApplicationBuilder app, IWebHostEnvironment env, Microsoft.Extensions.Hosting.IApplicationLifetime lifetime, ILoggerFactory loggerFactory) #pragma warning restore CS0618 // 类型或成员已过时 { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseAuthorization(); lifetime.ApplicationStarted.Register(() => { Utility.AspNetCore.Consul.ConsulExtensions.RegisterConsul(app, Configuration); Utility.AspNetCore.Zipkin.ZinkinExtensions.RegisterZipkin(app, loggerFactory, lifetime, Configuration["Zinkin:Address"], Configuration["Zinkin:Name"]); }); lifetime.ApplicationStopped.Register(() => { Utility.AspNetCore.Consul.ConsulExtensions.StopConsul(app); Utility.AspNetCore.Zipkin.ZinkinExtensions.StopZipkin(app); }); app.UseStaticFiles(new StaticFileOptions { FileProvider = new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(), "imgs")), RequestPath = "/imgs", }); Utility.AspNetCore.Extensions.ApplicationBuilderExtensions.Use(app, env, "OA Api V1"); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IApplicationLifetime lifetime) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseHttpsRedirection(); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); app.UseSwagger(); app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", "Knowledge Microservice V1"); }); app.UseMvc(); var bus = app.ApplicationServices.GetService <IBusControl>(); var busHandle = TaskUtil.Await(() => { return(bus.StartAsync()); }); lifetime.ApplicationStopping.Register(() => { busHandle.Stop(); }); }
public static void Main(string[] args) { //这里获取程序及和工作线程配置信息 Dictionary <string, Assembly> assmblyColl = new Dictionary <string, Assembly>(); var host = new HostBuilder() .UseEnvironment(EnvironmentName.Development) .ConfigureAppConfiguration((hostContext, configApp) => { //这里netcore支持多数据源,所以可以扩展到数据库或者redis,集中进行配置。 // configApp.SetBasePath(Directory.GetCurrentDirectory()); configApp.AddJsonFile( $"appsettings.{hostContext.HostingEnvironment.EnvironmentName}.json", optional: true); configApp.AddEnvironmentVariables("PREFIX_"); configApp.AddCommandLine(args); }).ConfigureLogging((hostContext, configBuild) => { configBuild.AddConfiguration(hostContext.Configuration.GetSection("Logging")); configBuild.AddConsole(); configBuild.AddCustomizationLogger(); }) .ConfigureServices((hostContext, service) => { service.Configure <HostOptions>(option => { option.ShutdownTimeout = System.TimeSpan.FromSeconds(10); }); service.AddKafka(KafkaBuilder => { KafkaBuilder.AddConfiguration(hostContext.Configuration.GetSection("KafkaService")); }); service.AddElasticsearchClient(config => { config.AddConfiguration(hostContext.Configuration.GetSection("ElasticsearchService")); }); service.AddDbContext <ConsoleDbContext>(option => option.UseMySQL(hostContext.Configuration.GetConnectionString("ConsoleDatabase")), ServiceLifetime.Transient, ServiceLifetime.Transient); ///TODO 待实现从数据库中pull数据,再将任务添加进DI service.AddSingleton <IConsole, KafkaToElasticsearch>(); }) .Build(); CancellationTokenSource source = new CancellationTokenSource(); CancellationToken token = source.Token; var task = Task.Run(async() => { IConsole console = host.Services.GetService <IConsole>(); await console.AsyncExcute(source.Token); }, source.Token); Dictionary <string, Task> dictTask = new Dictionary <string, Task>(); dictTask.Add("kafkatoelasticsearch", task); int recordRunCount = 0; var fact = host.Services.GetService <ILoggerFactory>(); var log = fact.CreateLogger <Program>(); var disp = Task.Run(() => { while (true) { if (!token.IsCancellationRequested) { ++recordRunCount; foreach (KeyValuePair <string, Task> item in dictTask) { if (item.Value.IsCanceled || item.Value.IsCompleted || item.Value.IsCompletedSuccessfully || item.Value.IsFaulted) { log.LogWarning("console任务:{0},参数:{1},执行异常,task状态:{2}", item.Key, "", item.Value.Status); if (item.Value.Exception != null) { log.LogError(item.Value.Exception, "task:{0},参数:{1},执行错误.", item.Key, ""); //TODO 根据参数更新数据库状态,以便被监控到。 } //更新数据库状态。 } } } System.Threading.Thread.Sleep(2000); log.LogInformation("循环:{0}次,接下来等待2秒。", recordRunCount); } }, source.Token); IApplicationLifetime appLiftTime = host.Services.GetService <IApplicationLifetime>(); appLiftTime.ApplicationStopping.Register(() => { log.LogInformation("程序停止中。"); source.Cancel(); log.LogInformation("程序停止完成。"); }); host.RunAsync().GetAwaiter().GetResult(); }
public void Configure(IApplicationBuilder app, IHostEnvironment environment, IConfiguration configuration, IApplicationServices applicationServices, IApplicationLifetime applicationLifetime, ILogger <Startup> logger) { var thisAssembly = typeof(Startup).Assembly; var assemblyName = thisAssembly.GetName(); var versionAttribute = thisAssembly.GetCustomAttribute <AssemblyFileVersionAttribute>(); var name = $"{ assemblyName.Name } API v{ versionAttribute.Version }"; var hostName = Dns.GetHostName(); var pathBase = configuration["PathBase"]; applicationLifetime.ApplicationStopping.Register(() => { applicationServices.Dispose(); }); logger.LogInformation("Configuring startup"); configuration["HydraDevOpsServicesBaseUrl"] = hostName + pathBase; app.UseExceptionHandler(o => { o.Run(async context => { var contextFeature = context.Features.Get <IExceptionHandlerFeature>(); if (contextFeature != null) { logger.LogError($"Error: { contextFeature.Error }"); await context.Response.BodyWriter.WriteAsync(ASCIIEncoding.UTF8.GetBytes(contextFeature.Error.Message)); } }); }); app.UsePathBase(pathBase); if (environment.IsDevelopment() || environment.IsStaging()) { app.UseOpenApi(); app.UseSwaggerUi3(c => { c.ServerUrl = pathBase; }); app.UseDeveloperExceptionPage(); } app.UseCors(AllowAll); app.UseHttpsRedirection(); app.UseRouting(); app.UseJwtServiceAuthorization(); app.UseAuthentication(); app.UseAuthorization(); app.UseStaticFiles(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); endpoints.MapRazorPages(); }); logger.LogInformation("End configuring startup"); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. #pragma warning disable CS0618 // 类型或成员已过时 public void Configure(IApplicationBuilder app, IWebHostEnvironment env, Microsoft.Extensions.Hosting.IApplicationLifetime lifetime, ILoggerFactory loggerFactory) #pragma warning restore CS0618 // 类型或成员已过时 { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Error"); // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } app.UseHttpsRedirection(); //暂时 放弃 直接放在iis上运行算了 //路劲新 映射 url docker 又不支持 有些可以有些不可以 注意:html 文件的js css等文件路劲没映射成功 //app.UseMiddleware<UrlMiddleware>(); //app.UseFileServer(); //wwwroot 有些 404 请求不了 //var options = new RewriteOptions() // .AddRedirect("admin/(.*)", "src/admin/$1") // .AddRedirect("company/(.*)", "src/ui/$1") // .AddRedirect("js/index.js", "src/js/index.js"); //app.UseRewriter(options); app.UseStaticFiles(); //发布时文件找不到 只能放在 wwwroot 这里了 docker 也不支持 只能用中间重定向 //可用参考:https://www.cnblogs.com/jidanfan/p/11670043.html app.UseStaticFiles(new StaticFileOptions() { FileProvider = new Microsoft.Extensions.FileProviders.PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory() + "\\src\\ui")), RequestPath = "/company", ServeUnknownFileTypes = true }); app.UseStaticFiles(new StaticFileOptions() { FileProvider = new Microsoft.Extensions.FileProviders.PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory() + "\\src\\admin")), RequestPath = "/admin", ServeUnknownFileTypes = true }); app.UseStaticFiles(new StaticFileOptions() { //Path.Combine(Environment.CurrentDirectory + "\\src\\js") FileProvider = new Microsoft.Extensions.FileProviders.PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory() + "\\src\\js")), //FileProvider = new Microsoft.Extensions.FileProviders.PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory() + "\\src\\js")), RequestPath = "/js", ServeUnknownFileTypes = true }); //直接使用模板 app.UseRouting(); app.UseAuthorization(); if (bool.TryParse(Configuration["EnableService"], out bool enable)) { if (enable) { app.RegisterConsul(Configuration.GetSection("Service").Get <ServiceEntity>()); } } if (bool.TryParse(Configuration["EnableZinkin"], out bool enableZinkin)) { if (enableZinkin) { app.RegisterZipkin(loggerFactory, lifetime, Configuration["Zinkin:Address"], Configuration["Zinkin:Name"]); } } lifetime.ApplicationStopped.Register(() => { app.StopConsul(); app.StopZipkin(); }); app.UseEndpoints(endpoints => { endpoints.MapRazorPages(); endpoints.MapControllers();//不添加 api consul调用失败 服务 注册失败 }); }
public TlsAlpn01DomainValidator(TlsAlpnChallengeResponder tlsAlpnChallengeResponder, IHostApplicationLifetime appLifetime, AcmeClient client, ILogger logger, string domainName) : base(appLifetime, client, logger, domainName) { _tlsAlpnChallengeResponder = tlsAlpnChallengeResponder; }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, UrlShrtDbContext context, ILogger <Startup> logger, Microsoft.Extensions.Hosting.IApplicationLifetime applicationLifetime) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/error"); } app.UseForwardedHeaders(); app.UseCors(builder => builder.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader()); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); var retries = 10; var delayMs = 5000; for (int i = 0; i < retries; i++) { try { context.Database.Migrate(); break; } catch (Microsoft.Data.SqlClient.SqlException ex) { if (i == retries - 1) { logger.LogError(ex, "Migration failed {retries}/{max_retries}. shutting down, {time} UTC", i + 1, retries, DateTime.UtcNow); applicationLifetime.StopApplication(); } else { logger.LogWarning("Migration failed on attempt {retries}/{max_retries}. Delaying exection for {delayMs} ms, {time} UTC", i + 1, retries, delayMs, DateTime.UtcNow); } } Task.Delay(delayMs); } }
public Http01DomainValidator(IHttpChallengeResponseStore challengeStore, IHostApplicationLifetime appLifetime, AcmeClient client, ILogger logger, string domainName) : base(appLifetime, client, logger, domainName) { _challengeStore = challengeStore; }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory, IApplicationLifetime appLifetime) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseSwagger(); app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "Api v1")); } loggerFactory.AddSerilog(); appLifetime.ApplicationStopped.Register(Log.CloseAndFlush); app.UseHttpsRedirection(); app.UseRouting(); // CORS // app.UseCors(); /* Enable * services.AddCors(options => * { * options.AddDefaultPolicy( * builder => * { * builder. * AllowAnyHeader(). * AllowAnyMethod(). * AllowCredentials(). * * WithOrigins(Configuration.GetSection("CORS:ConnectionString").Get<string>()); * * builder.Build(); * }); * }); */ // Logging app.UseMiddleware <RequestLoggingMiddleware>(); // Authentication app.UseAuthentication(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); // odata // endpoints.Select().Filter().OrderBy().Count().MaxTop(10); // endpoints.EnableDependencyInjection();//This guy solves the problem // endpoints.MapODataRoute("odata", "odata", GetEdmModel()); }); }