Let's walk through the parts that make up a modern ASP.NET Core MVC application.
Open the Startup.cs
file.
Note that the ConfigureServices
method adds support for MVC along with other frameworks and services such as ASP.NET Identity, as shown in the following code:
public void ConfigureServices(IServiceCollection services) { services.AddDbContext<ApplicationDbContext>(options => options.UseSqlServer(Configuration .GetConnectionString("DefaultConnection"))); services.AddIdentity<ApplicationUser, IdentityRole>() .AddEntityFrameworkStores<ApplicationDbContext>() .AddDefaultTokenProviders(); // Add application services. services.AddTransient<IEmailSender, EmailSender>(); services.AddMvc(); }
Next, we have the Configure
method, as shown in the following code:
public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) ...