[英]asp.net core - where to call MapRazorPages?
In ASP.NET Core 3.x, we add endpoints for Razor Pages with在 ASP.NET Core 3.x 中,我们为 Razor 页面添加了端点
app.UseEndpoints(endpoint =>
{
endpoint.MapRazorPages();
});
In the ASP.NET Core 6 Web App template (minimal hosting model), this has been changed to:在 ASP.NET Core 6 Web App 模板(最小托管模型)中,这已更改为:
app.MapRazorPages();
Apps typically don't need to call UseRouting or UseEndpoints.
应用程序通常不需要调用 UseRouting 或 UseEndpoints。 WebApplicationBuilder configures a middleware pipeline that wraps middleware added in Program.cs with UseRouting and UseEndpoints.
WebApplicationBuilder 配置一个中间件管道,该管道使用 UseRouting 和 UseEndpoints 包装 Program.cs 中添加的中间件。 For more information, see Routing in ASP.NET Core.
有关详细信息,请参阅 ASP.NET Core 中的路由。
My questions are:我的问题是:
app.MapRazorPages()
) is possible due to the middleware pipeline configuration by WebApplicationBuilder
?WebApplicationBuilder
的中间件管道配置,我假设第二种方式(即app.MapRazorPages()
)是正确的吗? (see snippet from MS docs above). Thank you in advance.先感谢您。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.