ASP.Net Core Introduction

Amos Xia, 2018-04-30 13:28:12

ASP.Net Core 简介

In Main entry class to set up basic settings for application. such as Content root, Web root, …

Moslty use Kestrel as web server behind IIS/nginx.

Server Set Up

Startup

  • Startup Class, configures the request pipeline that handles all requests made to the application
  • appsettings[.{env}].json, app settings configuration file
  • bundleconfig.json, configuration files for bundling and minifying front-end JavaScript and CSS assets.
  • wwwroot, Web application root folder for public static resources like css,js, …

Request Pipeline

Define request pipeline in Startup::Configure method by config Middleware to IApplicationBuilder instance.

Startup::Configure method specifies how the ASP.NET application will respond to HTTP requests.

Request delegates are used to build the request pipeline and handle HTTP request.

Request delegates are configured using Run, Map, and Use extension methods on the IApplicationBuilder instance in Startup::Configure method. - Run, short-circuits the pipeline, not call next request delegate - Map, branches request pipeline based on matches of the given request path. If the request path starts with the given path, the branch is executed. - Use, perform actions both before and after the next delegate

Middleware is constructed once per application lifetime at app startup.

Ordering Startup::ConfigureServices is optional, but usefull to config some service middlewares which used in Startup::Configure.

Reference

Difference ASP.Net Http Modules and Handlers with ASP.Net Core Middleware



知识共享许可协议
本作品采用知识共享署名 4.0 国际许可协议进行许可。


Copyright© 2018 s2u2m