Advertisement
wingman007

Startup.cs

Dec 1st, 2019
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.09 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Threading.Tasks;
  5. using Microsoft.AspNetCore.Builder;
  6. using Microsoft.AspNetCore.Hosting;
  7. using Microsoft.AspNetCore.Http;
  8. using Microsoft.AspNetCore.Mvc;
  9. using Microsoft.Extensions.DependencyInjection;
  10. using Microsoft.Extensions.Hosting;
  11.  
  12. namespace myweb
  13. {
  14.     public class Startup
  15.     {
  16.         // This method gets called by the runtime. Use this method to add services to the container.
  17.         // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
  18.         public void ConfigureServices(IServiceCollection services)
  19.         {
  20.             // services.AddMvc(); // services.AddMvc();
  21.             // MvcOptions.EnableEndpointRouting = false;
  22.             // services.AddRazorPages();
  23.  
  24.             // for Razor
  25.             //services.AddRazorPages();
  26.  
  27.             // for MVC
  28.             // services.AddControllersWithViews();
  29.  
  30.             // for API
  31.             services.AddControllers();
  32.         }
  33.  
  34.         // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
  35.         public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
  36.         {
  37.             if (env.IsDevelopment())
  38.             {
  39.                 app.UseDeveloperExceptionPage();
  40.             }
  41.             /* for API comment
  42.             else
  43.             {
  44.                 // for Razor
  45.                 // app.UseExceptionHandler("/Error");
  46.  
  47.                 // for MVC
  48.                 app.UseExceptionHandler("/Home/Error");
  49.  
  50.                 // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
  51.                 app.UseHsts();
  52.             }
  53.             */
  54.  
  55.             // for Razor
  56.             // for MVC
  57.             // for API
  58.             app.UseHttpsRedirection();
  59.  
  60.             // for Razor
  61.             // for MVC
  62.             // for API - comment
  63.             // app.UseStaticFiles();
  64.  
  65.             // for All
  66.             app.UseRouting();
  67.  
  68.  
  69.             // for Razor
  70.             // for MVC
  71.             // for API
  72.             app.UseAuthorization();
  73.  
  74.             //for Razor
  75.             // app.UseEndpoints(endpoints =>
  76.             // {
  77.             //     endpoints.MapRazorPages();
  78.             // });
  79.  
  80.             // for MVC
  81.             // app.UseEndpoints(endpoints =>
  82.             // {
  83.             //     endpoints.MapControllerRoute(
  84.             //         name: "default",
  85.             //         pattern: "{controller=Index}/{action=Index}/{id?}");
  86.             // });
  87.  
  88.             // for API
  89.             app.UseEndpoints(endpoints =>
  90.             {
  91.                 endpoints.MapControllers();
  92.             });
  93.  
  94.             // for web
  95.             // app.UseEndpoints(endpoints =>
  96.             // {
  97.             //     endpoints.MapGet("/", async context =>
  98.             //     {
  99.             //         await context.Response.WriteAsync("<h1>Hello World George S</h1>");
  100.             //     });
  101.             // });
  102.  
  103.         }
  104.     }
  105. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement