Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- app.UseDefaultFiles();
- app.UseStaticFiles();
- app.UseIdentity();
- public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) {
- loggerFactory.AddConsole(Configuration.GetSection("Logging"));
- loggerFactory.AddDebug();
- //add NLog to ASP.NET Core
- //loggerFactory.AddNLog();
- ////add NLog.Web
- //app.AddNLogWeb();
- //needed for non-NETSTANDARD platforms: configure nlog.config in your project root
- //env.ConfigureNLog("nlog.config");
- if (env.IsDevelopment()) {
- app.UseDeveloperExceptionPage();
- app.UseDatabaseErrorPage();
- app.UseBrowserLink();
- } else {
- app.UseExceptionHandler("/Home/Error");
- }
- app.UseDefaultFiles();
- app.UseStaticFiles();
- app.UseIdentity();
- // Add external authentication middleware below. To configure them please see http://go.microsoft.com/fwlink/?LinkID=532715
- app.UseMvcWithDefaultRoute();
- //app.UseMvc(routes => {
- // routes.MapRoute(
- // name: "default",
- // template: "{controller=Home}/{action=Index}/{id?}");
- //});
- // For more details on creating database during deployment see http://go.microsoft.com/fwlink/?LinkID=615859
- try {
- using (var serviceScope = app.ApplicationServices.GetRequiredService<IServiceScopeFactory>()
- .CreateScope()) {
- serviceScope.ServiceProvider.GetService<ChurBaseContext>()
- .Database.Migrate();
- var userManager = serviceScope.ServiceProvider.GetService<UserManager<ChurchMember>>();
- var roleManager = serviceScope.ServiceProvider.GetService<RoleManager<IdentityRole>>();
- serviceScope.ServiceProvider.GetService<ChurBaseContext>().EnsureSeedData(userManager, roleManager);
- }
- } catch { }
- }
- app.UseMvcWithDefaultRoute(); //in startup.cs
- app.UseMvc(routes =>
- {
- routes.MapRoute(
- name: "default",
- template: "{controller}/{action}/{id?}",
- defaults: new { controller = "Home", action = "Index" });
- });
- public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
- {
- ......
- app.UseStaticFiles();
- app.UseMvc(routes =>
- {
- routes.MapRoute(
- name: "default",
- template: "{controller=Home}/{action=Index}/{id?}");
- });
- }
- app.UseMvcWithDefaultRoute();
- app.Use(async (context, next) =>
- {
- // some custom magic
- await next();// don't forget this
- });
- app.UseMvc(routes =>
- {
- routes.MapRoute(
- name: "default",
- template: "{controller=Home}/{action=Index}/{id?}");
- });
Add Comment
Please, Sign In to add comment