Ask questionsUsing 'UseMvc' to configure MVC is not supported while using Endpoint Routing. To continue using 'UseMvc', please set 'MvcOptions.EnableEndpointRounting = false' inside 'ConfigureServices'.
I am getting the following warning from after upgrading an my ASP.NET Core Angular application from ASP.NET Core 3.0 Preview 3 to ASP.NET Core 3.0 Preview 4.
1>Startup.cs(75,13,80,15): warning MVC1005: Using 'UseMvc' to configure MVC is not supported while using Endpoint Routing. To continue using 'UseMvc', please set 'MvcOptions.EnableEndpointRounting = false' inside 'ConfigureServices'.
Then if I set MvcOptions.EnableEndpointRounting = false
as follows:
services.AddMvc(option => option.EnableEndpointRouting = false)
.AddNewtonsoftJson();
Then the warning goes away. My question is if I want to use EndpointRounting
then should I remove the following code:
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller}/{action=Index}/{id?}");
});
if not then what change I have to make?
Answer
questions
TanvirArjel
@davidfowl and @rynowak I have created a brand new ASP.NET Core Angular application with .NET Core 3.0 preview 4
SDK and I have found the following:
services.AddMvc(option => option.EnableEndpointRouting = false) .AddNewtonsoftJson();
that means Endpoint Routing
is disabled by default on ASP.NET Core 3.0 Angular application. My question is why it is disabled? Does ASP.NET Core 3.0 preview 4 SPA not support Endpoint Routing yet?
Related questions