

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the use of the Configure() method of startup class in C# Asp.net Core?
The configure method is present inside startup class of ASP.NET Core application
The Configure method is a place where you can configure application request pipeline for your application using IApplicationBuilder instance that is provided by the built-in IoC container
The Configure method by default has these three parameters IApplicationBuilder, IWebHostEnvironment and ILoggerFactory .
At run time, the ConfigureServices method is called before the Configure method. This is to register custom service with the IoC container which can be used in Configure method.
IWebHostEnvironment :Provides information about the web hosting environment an application is running in.
IApplicationBuilder:Defines a class that provides the mechanisms to configure an application's request pipeline.
Example
public void Configure(IApplicationBuilder app, IWebHostEnvironment env){ if (env.IsDevelopment()){ app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Error"); app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints =>{ endpoints.MapRazorPages(); }); }
- Related Questions & Answers
- Explain the purpose of the Startup class in ASP.NET Core
- What is the use of ChildActionOnly attribute in ASP .Net MVC C#?
- What is the significance of NonActionAttribute in ASP .Net MVC C#?
- What is ViewData in ASP .Net MVC C#?
- What is the use of UseIISIntegration in C# Asp.net Core?
- What are the three segments of the default route, that is present in ASP .Net MVC\nC#?
- How to use ViewBag in ASP .Net MVC C#?
- What is the use of StrictMath class in Java?
- Explain the purpose of the Program class in ASP.NET Core
- What is the use of the Cleaner class in Java 9?
- What is the use of the method setAutoCommit() in JDBC?
- What is the use of the series.duplicated() method in pandas?
- Explain the role of HttpContext class in ASP.NET Core
- What is the use of scipy.interpolate.interp1d class of SciPy python library?
- What is the use of forEach() method in JavaScript?