zoukankan      html  css  js  c++  java
  • ASP.NET Core MVC配置差异(3.0和2.X)

    https://www.cnblogs.com/lonelyxmas/p/10934388.html

    net core 2.x MVC配置

            public void ConfigureServices(IServiceCollection services)
            {
                services.addMvc();
            }
            public void Configure(IApplicationBuilder app, IWebHostEnvironment env,IConfiguration configurarion,IWelcome welcome)
            {
                if (env.IsDevelopment())
                {
                    app.UseDeveloperExceptionPage();
                }
    
                app.UseRouting();
                app.UseStaticFiles();
    
                app.UseMvc(routs =>
                {
                    routs.MapRoute("default", "{controller=Home}/{action=Index}/{id?}");
                });
            }

    net core 3.x MVC配置

            public void ConfigureServices(IServiceCollection services)
            {
                services.AddControllersWithViews();
            }
            public void Configure(IApplicationBuilder app, IWebHostEnvironment env,IConfiguration configurarion,IWelcome welcome)
            {
                if (env.IsDevelopment())
                {
                    app.UseDeveloperExceptionPage();
                }
    
                app.UseRouting();
                app.UseStaticFiles();
    
                app.UseEndpoints(endpoints =>
                {
                    endpoints.MapControllerRoute("default", "{controller=Home}/{action=Index}/{id?}");
                });
            }
  • 相关阅读:
    Rotate Image
    Color Sort
    Chapter 3: Binary Tree
    Different Ways to Add Parentheses
    最短路径问题
    Longest Palindromic Substring
    Word Break
    PCA和SVD简述
    Set Matrix Zeros
    星级评价
  • 原文地址:https://www.cnblogs.com/CelonY/p/11934653.html
Copyright © 2011-2022 走看看