(4) Net Core project startup file Startup

1. Introduction to Startup


1. The Startup file is the startup program of the Net Core application, which implements global configuration.

2. By default, Net Core, static files and sessions are not started, you need to configure the startup in the Startup file, otherwise it cannot be used.

 

 

2. Enable Session and enable default routing


 1. Enable Session: Add AddSession Services, add UseSession (must be before UseMvc, otherwise an error will be reported).

2. Enable default routing rules: replace app.UseMvc() with app.UseMvcWithDefaultRoute(). The routing rules will be introduced in the next article.

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325214350&siteId=291194637