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?
There's a section in this blog post called "Endpoint Routing Updates" that are relevant here. https://devblogs.microsoft.com/aspnet/asp-net-core-updates-in-net-core-3-0-preview-4/
Takea a look at this as well: https://docs.microsoft.com/en-us/aspnet/core/migration/22-to-30?view=aspnetcore-2.2&tabs=visual-studio#update-routing-startup-code
@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?
@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?
Just like this only
services.AddMvc(option => option.EnableEndpointRouting = false)
that worked for me!! :)
I see the 3.0 Spa templates using endpoint routing: https://github.com/aspnet/AspNetCore/blob/master/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Startup.cs#L105
Are you sure you've updated correctly?
@rynowak Yes! I see endpoint routing has been added in ASP.NET Core 3.0 GA release. If you want you can close the issue with marking as fixed!
Thank you.
like this only. i worked for me.
services.AddMvc(option => option.EnableEndpointRouting = false) ;
Most helpful comment
@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?