gpt4 book ai didi

asp.net-core-mvc - 我应该如何在 .net core 中设置 mvcoptions.enableendpointrouting

转载 作者:行者123 更新时间:2023-12-03 23:09:57 29 4
gpt4 key购买 nike

我已经添加了我厌倦的内容,我正在尝试在 ConfigureServices 方法中设置 mvcoptions.enableendpointrouting

  public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();

}

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
DeveloperExceptionPageOptions developerExceptionPageOptions = new DeveloperExceptionPageOptions()
{
SourceCodeLineCount = 1
};
app.UseDeveloperExceptionPage(developerExceptionPageOptions);
}

app.UseStaticFiles();
app.UseMvcWithDefaultRoute();

最佳答案

欢迎来到本站。您可以通过以下方式启用/禁用端点路由:

public void ConfigureServices(IServiceCollection services)
{
services.AddMvc(x => x.EnableEndpointRouting = false);
...
}

关于asp.net-core-mvc - 我应该如何在 .net core 中设置 mvcoptions.enableendpointrouting,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59318284/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com