public override Task ReadyAsync(IReadyContext context) { var app = context.Features.GetApplicationBuilder(); var picker = context.Features.GetServicePicker(); if (picker.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(); } #if !DEBUG app.UseHttpsRedirection(); #endif app.UseResponseCaching(); app.UseResponseCompression(); if (!picker.IsDevelopment) { app.UseSpaStaticFiles(); } app.UseRouting(); app.UseAuthentication(); app.UseAuthorization(); app.UseAzureSignalR(builder => { //builder.MapHub<ReadingHub>("/hubs/v1/reading"); }); app.UseSwagger(); app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/Anf/swagger.json", "Anf API"); }); app.UseEndpoints(endpoints => { endpoints.MapControllerRoute( name: "default", pattern: "{controller}/{action=Index}/{id?}"); }); app.UseSpa(spa => { // To learn more about options for serving an Angular SPA from ASP.NET Core, // see https://go.microsoft.com/fwlink/?linkid=864501 spa.Options.SourcePath = "ClientApp/dist"; if (picker.IsDevelopment) { spa.UseProxyToSpaDevelopmentServer("http://localhost:4200"); //spa.UseAngularCliServer(npmScript: "start"); } }); return(base.ReadyAsync(context)); }
public override async Task AfterReadyAsync(IReadyContext context) { context.UseKnowEngines(); var eng = context.GetComicEngine(); var tx = eng.FirstOrDefault(x => x is TencentComicSourceCondition); if (tx != null) { eng.Remove(tx); } using (var s = context.GetServiceScope()) { var db = s.ServiceProvider.GetRequiredService <AnfDbContext>(); db.Database.SetCommandTimeout(TimeSpan.FromMinutes(5)); db.Database.EnsureCreated(); } await base.AfterReadyAsync(context); }
public override async Task AfterReadyAsync(IReadyContext context) { await CreateSeedDataAsync(context); await base.AfterReadyAsync(context); }