// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseDatabaseErrorPage(); app.UseBrowserLink(); } else { app.UseExceptionHandler("/Home/Error"); } IdentityServerDatabaseInitialization.InitializeDatabase(app); app.UseStaticFiles(); app.UseIdentity(); app.UseIdentityServer(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseIdentityServer(); app.UseStaticFiles(); app.UseMvcWithDefaultRoute(); IdentityServerDatabaseInitialization.InitializeDatabase(app); }
public static void Main(string[] args) { var host = BuildWebHost(args); using (var scope = host.Services.CreateScope()) { var services = scope.ServiceProvider; try { IdentityServerDatabaseInitialization.InitializeDatabase(services); } catch (Exception ex) { var logger = services.GetRequiredService <ILogger <Program> >(); logger.LogError(ex, "An error occurred Initializing the DB."); } } host.Run(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseDatabaseErrorPage(); app.UseBrowserLink(); } else { app.UseExceptionHandler("/Home/Error"); } IdentityServerDatabaseInitialization.InitializeDatabase(app); app.UseStaticFiles(); app.UseIdentity(); app.UseIdentityServer(); app.UseTwitterAuthentication(new TwitterOptions { AuthenticationScheme = "Twitter", DisplayName = "Twitter", SignInScheme = "Identity.External", ConsumerKey = Configuration["Authentication:Twitter:ConsumerKey"], ConsumerSecret = Configuration["Authentication:Twitter:ConsumerSecret"] }); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } //app.UseCors(policy => //{ // policy.AllowAnyHeader(); // policy.AllowAnyMethod(); // policy.AllowAnyOrigin(); //}); app.UseIdentityServer(); IdentityServerDatabaseInitialization.InitializeDatabase(app); //app.UseOpenIdConnectAuthentication(new IdentityServerAuthenticationOptions //{ // Authority = "http://localhost:5000", // RequireHttpsMetadata = false, // ApiName = "resourceApi" //}); app.UseMvc(); }