Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Additional Areas #2712


User avatar
0
fourier created

Hi, If I want to add more Areas instead of just the Mpa but I want to use the same Menu structure and Layout as used in Mpa I get the below error, is there a guideline?

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


8 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    It should work automatically. Can you share your Dashboard controller definition ?

    Thanks.

  • User Avatar
    0
    fourier created

    The Controller Index (code below) gets hit but then I get the error (below code)

    Code: using System.Web.Mvc; using Abp.Web.Mvc.Authorization; using FS.MultiTenant_MVC.Authorization; namespace FS.MultiTenant_MVC.Web.Areas.Sales.Controllers { [AbpMvcAuthorize(AppPermissions.Sales_Dashboard)] public class DashboardController : Controller { // GET: Sales/Dashboard public ActionResult Index() { return View(); } } }

    Error: The controller for path '/Sales/Dashboard' was not found or does not implement IController.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Web.HttpException: The controller for path '/Sales/Dashboard' was not found or does not implement IController.

    Source Error:

    Line 61: Line 62: <div class="page-header navbar navbar-fixed-top md-shadow-zero-light"> Line 63: @Html.Action("Header", "Layout") Line 64: </div> Line 65:

    Source File: c:\Dev\DDD\ZeroTrussMS\src\FS.MultiTenant_MVC.Web\Areas\Sales\Views\Layout_Layout.cshtml Line: 63

    Stack Trace:

    [HttpException (0x80004005): The controller for path '/Sales/Dashboard' was not found or does not implement IController.] System.Web.Mvc.DefaultControllerFactory.GetControllerInstance(RequestContext requestContext, Type controllerType) +216 Abp.Web.Mvc.Controllers.WindsorControllerFactory.GetControllerInstance(RequestContext requestContext, Type controllerType) in D:\Halil\Github\aspnetboilerplate\src\Abp.Web.Mvc\Web\Mvc\Controllers\WindsorControllerFactory.cs:47 System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName) +88 System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory) +194 System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) +50 System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext httpContext, AsyncCallback callback, Object state) +48 System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) +16 System.Web.Mvc.<>c__DisplayClass7.<BeginProcessRequest>b__6() +31 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) +1981 System.Web.HttpServerUtility.Execute(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage) +76 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) +463 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) +10 ASP._Page_Areas_Sales_Views_Layout__Layout_cshtml.Execute() in c:\Dev\DDD\ZeroTrussMS\src\FS.MultiTenant_MVC.Web\Areas\Sales\Views\Layout\_Layout.cshtml:63 System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +197 System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +105 System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +90 System.Web.WebPages.&lt;&gt;c__DisplayClass3.&lt;RenderPageCore&gt;b__2(TextWriter writer) +232 System.Web.WebPages.HelperResult.WriteTo(TextWriter writer) +10 System.Web.WebPages.WebPageBase.Write(HelperResult result) +80 System.Web.WebPages.WebPageBase.RenderSurrounding(String partialViewName, Action1 body) +63 System.Web.WebPages.WebPageBase.PopContext() +237 System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +98 System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +256 System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) +107 System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +291 System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) +13 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +56 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +420 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList1 filters, ActionResult actionResult) +52 System.Web.Mvc.Async.&lt;&gt;c__DisplayClass2b.&lt;BeginInvokeAction&gt;b__1c() +173 System.Web.Mvc.Async.&lt;&gt;c__DisplayClass21.&lt;BeginInvokeAction&gt;b__1e(IAsyncResult asyncResult) +100 System.Web.Mvc.Async.WrappedAsyncResult1.CallEndDelegate(IAsyncResult asyncResult) +10 System.Web.Mvc.Async.WrappedAsyncResultBase1.End() +49 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +27 System.Web.Mvc.Controller.&lt;BeginExecuteCore&gt;b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +13 System.Web.Mvc.Async.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult) +29 System.Web.Mvc.Async.WrappedAsyncResultBase1.End() +49 System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +36 System.Web.Mvc.Controller.&lt;BeginExecute&gt;b__15(IAsyncResult asyncResult, Controller controller) +12 System.Web.Mvc.Async.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult) +22 System.Web.Mvc.Async.WrappedAsyncResultBase1.End() +49 System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +26 System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10 System.Web.Mvc.MvcHandler.&lt;BeginProcessRequest&gt;b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +21 System.Web.Mvc.Async.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult) +29 System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49 System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +28 System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9765121 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    I think you need to derive your controller from the BaseController created in your project. You can check HomeController for that.

  • User Avatar
    0
    fourier created

    It gives the same issue. I had it like below but changed it to try and see if it solves the problem:

    [AbpMvcAuthorize(AppPermissions.Sales_Dashboard)] public class DashboardController : MultiTennant_MVCControllerBase }

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    I think you need to add area name to your menu item definition just like we did here for Mpa area <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero/blob/master/src/MyCompanyName.AbpZeroTemplate.Web/Areas/Mpa/Startup/MpaNavigationProvider.cs#L20">https://github.com/aspnetzero/aspnet-ze ... der.cs#L20</a>.

    Please let us know if it does not work.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Thank you for sending your solution. Since you use _Layout.cshtml of MPA area, this error happens. You can fix it by adding MPA area name to @Html.Action usages in _Layout.cshtml.

    For example @Html.Action("Header", "Layout") becomes @Html.Action("Header", "Layout", new { area = "Mpa" }) @Html.Action("Sidebar", "Layout", new { currentPageName = ViewBag.CurrentPageName }) becomes @Html.Action("Sidebar", "Layout", new { currentPageName = ViewBag.CurrentPageName, area = "Mpa" })

  • User Avatar
    0
    olivierroecker created

    I have exactly the same problem... I have added area="Mpa" in the html.action line in_layout file from Area MPA Folder . It was worked some time, but now the _layout in the folder src/PhoneBook/Views/layout run this issue, and the workaround is not possible;

    Do you have a tutorial which explain how use a new area for custom dev, it will be a better source code implemetation :P ? Bests Regards Olivier

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @OlivierRoecker,

    Sorry I couldn't understand your case very well. Can you explain it a little bit more detailed ?

    By the way, we don't have a document about this at the moment.

    Thanks.