Solucionado (ver solução)
Solucionado
(ver solução)
1
resposta

Erro ao subir a aplicação - Message=Endpoint Routing does not support 'IApplicationBuilder.UseMvc(...)'

Bom dia Após instalar o mvc e tentar subir a aplicação recebo este erro:

System.InvalidOperationException HResult=0x80131509 Message=Endpoint Routing does not support 'IApplicationBuilder.UseMvc(...)'. To use 'IApplicationBuilder.UseMvc' set 'MvcOptions.EnableEndpointRouting = false' inside 'ConfigureServices(...). Source=Microsoft.AspNetCore.Mvc.Core StackTrace: at Microsoft.AspNetCore.Builder.MvcApplicationBuilderExtensions.UseMvc(IApplicationBuilder app, Action`1 configureRoutes) in //src/Mvc/Mvc.Core/src/Builder/MvcApplicationBuilderExtensions.cs:line 91 at Microsoft.AspNetCore.Builder.MvcApplicationBuilderExtensions.UseMvcWithDefaultRoute(IApplicationBuilder app) in //src/Mvc/Mvc.Core/src/Builder/MvcApplicationBuilderExtensions.cs:line 53 at Alura.Lista.Leitura.Startup.Configure(IApplicationBuilder app) in C:\Users\quafla01\source\repos\Alura.Lista.Leitura\Alura.Lista.Leitura\Startup.cs:line 19 at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) in //src/System.Private.CoreLib/src/System/Reflection/RuntimeMethodInfo.cs:line 469 at Microsoft.AspNetCore.Hosting.ConfigureBuilder.Invoke(Object instance, IApplicationBuilder builder) in //src/Hosting/Hosting/src/Internal/ConfigureBuilder.cs:line 31 at Microsoft.AspNetCore.Hosting.ConfigureBuilder.<>c__DisplayClass4_0.b__0(IApplicationBuilder builder) in //src/Hosting/Hosting/src/Internal/ConfigureBuilder.cs:line 20 at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app) in //src/Hosting/Hosting/src/Startup/ConventionBasedStartup.cs:line 25 at Microsoft.AspNetCore.Mvc.Filters.MiddlewareFilterBuilderStartupFilter.<>c__DisplayClass0_0.g__MiddlewareFilterBuilder|0(IApplicationBuilder builder) in //src/Mvc/Mvc.Core/src/Filters/MiddlewareFilterBuilderStartupFilter.cs:line 23 at Microsoft.AspNetCore.Hosting.WebHost.BuildApplication() in //src/Hosting/Hosting/src/Internal/WebHost.cs:line 230 at Microsoft.AspNetCore.Hosting.WebHost.d__27.MoveNext() in //src/Hosting/Hosting/src/Internal/WebHost.cs:line 148 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in //src/System.Private.CoreLib/shared/System/Runtime/ExceptionServices/ExceptionDispatchInfo.cs:line 63 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) in //src/System.Private.CoreLib/shared/System/Runtime/CompilerServices/TaskAwaiter.cs:line 180 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) in //src/System.Private.CoreLib/shared/System/Runtime/CompilerServices/TaskAwaiter.cs:line 151 at System.Runtime.CompilerServices.TaskAwaiter.GetResult() in //src/System.Private.CoreLib/shared/System/Runtime/CompilerServices/TaskAwaiter.cs:line 107 at Microsoft.AspNetCore.Hosting.WebHostExtensions.d__5.MoveNext() in //src/Hosting/Hosting/src/WebHostExtensions.cs:line 111 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in //src/System.Private.CoreLib/shared/System/Runtime/ExceptionServices/ExceptionDispatchInfo.cs:line 63 at Microsoft.AspNetCore.Hosting.WebHostExtensions.d__5.MoveNext() in //src/Hosting/Hosting/src/WebHostExtensions.cs:line 145 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in //src/System.Private.CoreLib/shared/System/Runtime/ExceptionServices/ExceptionDispatchInfo.cs:line 63 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) in //src/System.Private.CoreLib/shared/System/Runtime/CompilerServices/TaskAwaiter.cs:line 180 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) in //src/System.Private.CoreLib/shared/System/Runtime/CompilerServices/TaskAwaiter.cs:line 151 at System.Runtime.CompilerServices.TaskAwaiter.GetResult() in //src/System.Private.CoreLib/shared/System/Runtime/CompilerServices/TaskAwaiter.cs:line 107 at Microsoft.AspNetCore.Hosting.WebHostExtensions.d__4.MoveNext() in //src/Hosting/Hosting/src/WebHostExtensions.cs:line 95 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in //src/System.Private.CoreLib/shared/System/Runtime/ExceptionServices/ExceptionDispatchInfo.cs:line 63 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) in /_/src/System.Private. ...

e etc...

1 resposta
solução!

no método ConfigureServices da classe Startup.cs adicionei alguns parametros ao método AddMvc:

services.AddMvc(options => options.EnableEndpointRouting = false);

dessa forma a aplicação subiu normalmente e pude testar o endpoint https://localhost:5001/Livros/Teste com sucesso.

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software