I'm new to NOP and MVC in general, but I've been doing .net development for many years.
I've been following the guide on how to create a new plugin, but when I try to load the configure page,
I get the following stack trace:
Exception Stack Trace
Server Error in '/' Application.
The controller for path '/Admin/Plugin/ConfigureMiscPlugin' 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 '/Admin/Plugin/ConfigureMiscPlugin' was not found or does not implement IController.
Source Error:
Line 13: {
Line 14: <strong>@Model.ConfigurationControllerName</strong><span>.</span>@Model.ConfigurationActionName
Line 15: @Html.Action(Model.ConfigurationActionName, Model.ConfigurationControllerName, Model.ConfigurationRouteValues);
Line 16: }
Line 17: else
Source File: c:\Work Files\AVCGroup\shop.avcgroup.co.nz\Web\Administration\Views\Plugin\ConfigureMiscPlugin.cshtml Line: 15
Stack Trace:
[HttpException (0x80004005): The controller for path '/Admin/Plugin/ConfigureMiscPlugin' was not found or does not implement IController.]
System.Web.Mvc.DefaultControllerFactory.GetControllerInstance(RequestContext requestContext, Type controllerType) +565977
System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName) +89
System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory) +305
System.Web.Mvc.<>c__DisplayClass6.<BeginProcessRequest>b__2() +78
System.Web.Mvc.<>c__DisplayClassb`1.<ProcessInApplicationTrust>b__a() +19
System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Func`1 func) +128
System.Web.Mvc.ServerExecuteHttpHandlerWrapper.Wrap(Func`1 func) +41
[HttpException (0x80004005): Execution of the child request failed. Please examine the InnerException for more information.]
System.Web.Mvc.ServerExecuteHttpHandlerWrapper.Wrap(Func`1 func) +662300
System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride) +3976
System.Web.HttpServerUtility.Execute(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage) +275
System.Web.HttpServerUtilityWrapper.Execute(IHttpHandler handler, TextWriter writer, Boolean preserveForm) +94
System.Web.Mvc.Html.ChildActionExtensions.ActionHelper(HtmlHelper htmlHelper, String actionName, String controllerName, RouteValueDictionary routeValues, TextWriter textWriter) +828
System.Web.Mvc.Html.ChildActionExtensions.Action(HtmlHelper htmlHelper, String actionName, String controllerName, RouteValueDictionary routeValues) +123
ASP._Page_Administration_Views_Plugin_ConfigureMiscPlugin_cshtml.Execute() in c:\Work Files\AVCGroup\shop.avcgroup.co.nz\Web\Administration\Views\Plugin\ConfigureMiscPlugin.cshtml:15
System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +280
System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +104
System.Web.WebPages.StartPage.ExecutePageHierarchy() +143
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +157
System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +378
System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() +33
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +727904
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +727904
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +265
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +727860
System.Web.Mvc.Controller.ExecuteCore() +159
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +334
System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +62
System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +15
System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +52
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +607
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +288
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.17626
I've followed the guide and I'm pretty sure that I haven't missed anything.
I even took another plugin that was working (the MailChimp one) and renamed the classes, assemblies etc.
When I left the controller named "SettingsController" in my copy, I'd get the mailchimp settings page, not my own.
When I rename the controller, I get this.
The code appears to be in the correct place as my Provider can be invoked and is returning the values I'd expect, but here are a few snippets from the RouteProvider, PluginProvider and Controller
RouteProvider
public class RouteProvider : IRouteProvider
{
public void RegisterRoutes(RouteCollection routes)
{
var route = routes.MapRoute("Plugin.Misc.DomainRoles.Configure", "Admin/Plugin/MiscDomainRoles/DomainRolesSettings/Configure",
new { controller = "DomainRolesSettings", action = "Index" },
new[] { "Nop.Plugin.Misc.DomainRoles.Controllers" }
);
route.DataTokens.Add("area", "admin");
}
}
Plugin
public class DomainRolesPlugin : BasePlugin, IMiscPlugin
{
public DomainRolesPlugin()
{
}
public void GetConfigurationRoute(out string actionName, out string controllerName, out RouteValueDictionary routeValues)
{
actionName = "Index";
controllerName = "DomainRolesSettings";
routeValues = new RouteValueDictionary { { "Namespaces", "Nop.Plugin.Misc.DomainRoles.Controllers" }, { "area", null } };
}
}
Controller
[AdminAuthorize]
public class DomainRolesSettingsController : Controller
{
private const string VIEW_PATH = "Nop.Plugin.Misc.DomainRoles.Views.DomainRolesSettings.Index";
public DomainRolesSettingsController()
{
}
[NonAction]
private DomainRolesMappingsModel PrepareModel()
{
var model = new DomainRolesMappingsModel();
return model;
}
public ActionResult Index()
{
var model = PrepareModel();
//Return the view
return View(VIEW_PATH, model);
}
}
I've also put a zip file of my project up on dropbox if someone would like to review what I've done.
I'm getting a little frustrated as I'm sure I've missed something simple.
The link is here (this is the original version before I copied the mailchimp plugin but it was doing the same thing)
https://dl.dropbox.com/u/2923715/Sniper.Nop.Plugin.Core.DomainRoles.zip
My folder structure is (in case you look at the output path)
/Code/<my plugin project>/... [Controllers,Views etc]
/Web/<nop published project>
Cool, hope someone can help.
Gareth