【发布时间】:2020-10-29 14:55:06
【问题描述】:
当我创建一个新的ASP.NET Core Web Application 并选择API 项目模板并运行它时,它会路由到http://localhost:64221/weatherforecast。我可以知道它在哪里配置默认路由到weatherforecast web api?在configure 方法中,我没有看到到weatherforecast 的任何默认路由。
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseRouting();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
}
【问题讨论】:
标签: c# asp.net-core asp.net-core-webapi asp.net-core-routing