Ghi
Quyền truy cập vào trang này yêu cầu sự cho phép. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Quyền truy cập vào trang này yêu cầu sự cho phép. Bạn có thể thử thay đổi thư mục.
| Value | |
|---|---|
| Rule ID | MVC1005 |
| Fix is breaking or non-breaking | Non-breaking |
Cause
UseMvc was invoked as part of startup.
Rule description
Using MVC via UseMvc or UseMvcWithDefaultRoute requires an explicit opt-in inside Startup.ConfigureServices. This is required because MVC must know whether it can rely on the authorization and CORS Middleware during initialization.
How to fix violations
If the app requires legacy IRouter support, disable EnableEndpointRoutingusing any of the following approaches in Startup.ConfigureServices:
services.AddMvc(options => options.EnableEndpointRouting = false);
If legacy IRouter support is not required, replace the call to UseMvc with UseEndpoints. For more details, see the migration guide.
When to suppress warnings
Do not suppress a warning from this rule.
ASP.NET Core