liveBook · Manning

Startup.Configure

As explained in ASP.NET Core in Action, 3e

Configure is the conventional ASP.NET Core Startup method that builds an application's middleware pipeline and endpoint configuration.

Startup.Configure builds the ASP.NET Core middleware pipeline and registers endpoint mappings. The host calls ConfigureServices first, then Configure, making registered services available for dependency injection in Configure. Middleware runs in the order it is added. section 30.3 section 30.7

Listing 30.2 An outline of Startup.cs showing how each aspect is configured
public class Startup
{
    public void ConfigureServices(IServiceCollection services)  #1
    {
        // method details
    }
    public void Configure(IApplicationBuilder app)              #2
    {
        // method details
    }
}

Use the Startup outline to distinguish Configure from ConfigureServices and see the conventional method shape. section 30.3

A Razor Pages pipeline

A practical Configure method can inject IApplicationBuilder and IWebHostEnvironment, select development or production error handling, then add HTTPS redirection, static files, routing, authentication, authorization, and endpoint mappings. The endpoint stage calls endpoints.MapRazorPages(). section 30.3 section 30.7

How ASP.NET Core in Action, 3e covers it

How deep it goes
Explains invocation order, dependency injection, middleware ordering, and explicit endpoint middleware, without detailing middleware internals.
Examples
Demonstrates development error pages, production exception handling, HTTPS redirection, static files, Razor Pages, and endpoint mapping.
What it assumes
Assumes familiarity with Startup and ConfigureServices while showing how registered services and host environment values enter Configure.
What you can do after
Operate an ASP.NET Core application by ordering middleware and registering Razor Pages endpoints in Startup.Configure.
How it connects
Connects Startup.Configure with ConfigureServices, dependency injection, middleware, routing, authentication, authorization, and endpoint routing.

This explainer was generated by Manning's knowledge graph from the text of ASP.NET Core in Action, 3e. The section links point to the parts of the book it draws on.