Adding an item into sitemap.config results in page not found

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
6 years ago
I added the line below into the sitemap.config. The item shows as expected on the Admin Menu.

    <siteMapNode SystemName="StoreToolset" nopResource="Admin.StoreToolset" controller="StoreToolset" action="Index" IconClass="fa-wrench" />

However clicking on the link results in Page not found. The controller action Index doesn't hit when debugging. Controller is under Nop.Admin\Controllers\SalesHelper

Controller:

using System.Web.Mvc;

namespace Nop.Admin.Controllers.SalesHelper
{
    public partial class StoreToolsetController : BaseAdminController
    {
        public ActionResult Index()
        {
            return View();
        }
    }
}


View

@{
    ViewBag.Title = "Store Sales Utility";
}

<h2>Hello world</h2>

What am I missing?

Thanks.
6 years ago
Did you try with Clean build whole solution ?
6 years ago
Yes I already did that. No change. Still Page not found.
The error in log is:

System.Web.HttpException (0x80004005): The controller for path '/Admin/StoreToolset' was not found or does not implement IController. at System.Web.Mvc.DefaultControllerFactory.GetControllerInstance(RequestContext requestContext, Type controllerType) at System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName) at System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory) at System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) at System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext httpContext, AsyncCallback callback, Object state) at System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
6 years ago
[email protected] wrote:
Yes I already did that. No change. Still Page not found.
The error in log is:

System.Web.HttpException (0x80004005): The controller for path '/Admin/StoreToolset' was not found or does not implement IController. at System.Web.Mvc.DefaultControllerFactory.GetControllerInstance(RequestContext requestContext, Type controllerType) at System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName) at System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory) at System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) at System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext httpContext, AsyncCallback callback, Object state) at System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)


Can you try with rename the Action Name i.e ==>


  <siteMapNode SystemName="StoreToolset" nopResource="Admin.StoreToolset" controller="StoreToolset" action="List" IconClass="fa-wrench" />


Controller:

using System.Web.Mvc;

namespace Nop.Admin.Controllers.SalesHelper
{
    public partial class StoreToolsetController : BaseAdminController
    {
        public ActionResult List()
        {
            return View();
        }
    }
}

6 years ago
I'm not sure what's missing. I still get the same issue.

System.Web.HttpException (0x80004005): The controller for path '/Admin/StoreToolset/List' was not found or does not implement IController. at System.Web.Mvc.DefaultControllerFactory.GetControllerInstance(RequestContext requestContext, Type controllerType) at System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName) at System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory) at System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) at System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext httpContext, AsyncCallback callback, Object state) at System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Sitemap.config

  <siteMapNode SystemName="Home" nopResource="Admin.Home" controller="Home" action="Overview">
    <siteMapNode SystemName="Dashboard" nopResource="Admin.Dashboard" controller="Home" action="Index" IconClass="fa-desktop" />
    <siteMapNode SystemName="StoreToolset" nopResource="Admin.StoreToolset" controller="StoreToolset" action="List" IconClass="fa-wrench" />

Controller:

using System.Web.Mvc;

namespace Nop.Admin.Controllers.SalesHelper
{
    public partial class StoreToolsetController : BaseAdminController
    {
        public ActionResult List()
        {
            return View();
        }
    }
}
6 years ago
[email protected] wrote:
I'm not sure what's missing. I still get the same issue.

System.Web.HttpException (0x80004005): The controller for path '/Admin/StoreToolset/List' was not found or does not implement IController. at System.Web.Mvc.DefaultControllerFactory.GetControllerInstance(RequestContext requestContext, Type controllerType) at System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName) at System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory) at System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) at System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext httpContext, AsyncCallback callback, Object state) at System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Sitemap.config

  <siteMapNode SystemName="Home" nopResource="Admin.Home" controller="Home" action="Overview">
    <siteMapNode SystemName="Dashboard" nopResource="Admin.Dashboard" controller="Home" action="Index" IconClass="fa-desktop" />
    <siteMapNode SystemName="StoreToolset" nopResource="Admin.StoreToolset" controller="StoreToolset" action="List" IconClass="fa-wrench" />

Controller:

using System.Web.Mvc;

namespace Nop.Admin.Controllers.SalesHelper
{
    public partial class StoreToolsetController : BaseAdminController
    {
        public ActionResult List()
        {
            return View();
        }
    }
}


Could you confirm your plugin is installed? And Plugin dll has in Nop.web Plugin folder, Try with debug mode.
6 years ago
I'm not making a plugin. I want to add an item to the Admin menu just like Dashboard, Catalog, Sales, Customers, etc... I figure there isn't a need for a plugin.
6 years ago
Also I notice. If I use the http://localhost:15536/StoreToolset/List, then the controller is hit. How come? Doesn't the route defined in sitemap.config already have Area = Admin? What should I do here to make this route http://localhost:15536/Admin/StoreToolset/List to work?
6 years ago
Found the issue. Turns out you can't put StoreToolsetController.cs inside another directory because the AdminAreaRegistration has a constraint on new[] { "Nop.Admin.Controllers" }.

    public class AdminAreaRegistration : AreaRegistration
    {
        public override string AreaName => "Admin";

        public override void RegisterArea(AreaRegistrationContext context)
        {
            context.MapRoute(
                "Admin_default",
                "Admin/{controller}/{action}/{id}",
                new { controller = "Home", action = "Index", area = "Admin", id = "" },
                new[] { "Nop.Admin.Controllers" }
            );
        }
    }

It's working now.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.