I have added what I have tired , I'm trying to set mvcoptions.enableendpointrouting in ConfigureServices method
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();
Endpoint routing is used to match HTTP requests to MVC actions, and to generate URLs with IUrlHelper. public: property bool EnableEndpointRouting { bool get(); void set(bool value); }; C# Copy.
UseRouting adds route matching to the middleware pipeline. This middleware looks at the set of endpoints defined in the app, and selects the best match based on the request. UseEndpoints adds endpoint execution to the middleware pipeline. It runs the delegate associated with the selected endpoint.
UseRouting adds metadata that can be used by subsequent middleware. UseEndpoints executes the Controller and corresponding handler.
UseMvc(IApplicationBuilder) Adds MVC to the IApplicationBuilder request execution pipeline. UseMvc(IApplicationBuilder, Action<IRouteBuilder>) Adds MVC to the IApplicationBuilder request execution pipeline.
Welcome to the site. You can enable/disable endpoint routing the following way:
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc(x => x.EnableEndpointRouting = false);
...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With