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

Dúvida no Ex. 6 da Aula 2 - Utilizando templates

Eu fiz como consta no vídeo e na explicação. Mas o Visual Studio não reconhece o @Html.Action ("Index", "MenuController") e dá erro.

"The controller for path '/' was not found or does not implement IController."}

The controller for path '/' was not found or does not implement IController.

Descrição: Ocorreu uma exceção sem tratamento durante a execução da atual solicitação da Web. Examine o rastreamento de pilha para obter mais informações sobre o erro e onde foi originado no código.

Detalhes da Exceção: System.Web.HttpException: The controller for path '/' was not found or does not implement IController.

Erro de Origem:

Linha 35:

Linha 36:
Linha 37: @Html.Action("Index", "MenuController") Linha 38:
Linha 39:

Arquivo de Origem: d:\Alura\LojaRazor\LojaRazor\Views\Shared_Layout.cshtml Linha: 37

Rastreamento de Pilha:

[HttpException (0x80004005): The controller for path '/' was not found or does not implement IController.] System.Web.Mvc.DefaultControllerFactory.GetControllerInstance(RequestContext requestContext, Type controllerType) +430058 System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName) +74 System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory) +214 System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) +49 System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext httpContext, AsyncCallback callback, Object state) +49 System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) +18 System.Web.Mvc.<>cDisplayClass7.b6() +32 System.Web.Mvc.ServerExecuteHttpHandlerWrapper.Wrap(Func`1 func) +27

[HttpException (0x80004005): Execution of the child request failed. Please examine the InnerException for more information.] System.Web.Mvc.ServerExecuteHttpHandlerWrapper.Wrap(Func1 func) +102 System.Web.Mvc.ServerExecuteHttpHandlerAsyncWrapper.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) +98 System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride) +1983 System.Web.HttpServerUtility.Execute(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage) +77 System.Web.HttpServerUtility.Execute(IHttpHandler handler, TextWriter writer, Boolean preserveForm) +29 System.Web.HttpServerUtilityWrapper.Execute(IHttpHandler handler, TextWriter writer, Boolean preserveForm) +24 System.Web.Mvc.Html.ChildActionExtensions.ActionHelper(HtmlHelper htmlHelper, String actionName, String controllerName, RouteValueDictionary routeValues, TextWriter textWriter) +495 System.Web.Mvc.Html.ChildActionExtensions.Action(HtmlHelper htmlHelper, String actionName, String controllerName, RouteValueDictionary routeValues) +83 System.Web.Mvc.Html.ChildActionExtensions.Action(HtmlHelper htmlHelper, String actionName, String controllerName) +15 ASP._Page_Views_Shared__Layout_cshtml.Execute() in d:\Alura\LojaRazor\LojaRazor\Views\Shared\_Layout.cshtml:37 System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +196 System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +127 System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +88 System.Web.WebPages.<>c__DisplayClass7.<RenderPageCore>b__6(TextWriter writer) +244 System.Web.WebPages.HelperResult.WriteTo(TextWriter writer) +15 System.Web.WebPages.WebPageBase.Write(HelperResult result) +95 System.Web.WebPages.WebPageBase.RenderSurrounding(String partialViewName, Action1 body) +64 System.Web.WebPages.WebPageBase.PopContext() +310 System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +95 System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +259 System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) +115 System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +294 System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) +15 System.Web.Mvc.<>cDisplayClass1a.b17() +23 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func1 continuation) +242 System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() +25 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList1 filters, ActionResult actionResult) +175 System.Web.Mvc.Async.<>cDisplayClass2a.b20() +89 System.Web.Mvc.Async.<>cDisplayClass25.b22(IAsyncResult asyncResult) +102 System.Web.Mvc.Async.WrappedAsyncResult1.End() +58 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +44 System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__18(IAsyncResult asyncResult) +15 System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +16 System.Web.Mvc.Async.WrappedAsyncResult1.End() +58 System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +54 System.Web.Mvc.Async.<>cDisplayClass4.b3(IAsyncResult ar) +16 System.Web.Mvc.Async.WrappedAsyncResult1.End() +58 System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +44 System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +12 System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult) +25 System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +16 System.Web.Mvc.Async.WrappedAsyncResult1.End() +58 System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +44 System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +11 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9742689 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155

1 resposta
solução!

Fala Renan, tudo bem?

Cara, troque o "MenuController" por apenas "Menu", assim:

 @Html.Action ("Index", "Menu")

E veja se funciona :)