Another plugin problem

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
Hace 12 años
I have looked at the MVC-ControllerTypeCache.XML and no matter what I do including the application restart I still cannot see my controller registered there.

I end up with the following error when I try to configure the plugin. The plugin installs without any problems though

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

Here is my code any help would be much appreciated


namespace Nop.Plugin.Misc.StoreLocator
{
    public partial class RouteProvider : IRouteProvider
    {
        public void RegisterRoutes(RouteCollection routes)
        {
            routes.MapRoute("Plugin.Misc.StoreLocator.Configure",
                 "Plugins/MiscStoreLocator/Configure",
                 new { controller = "MiscStoreLocator", action = "Configure" },
                 new[] { "Nop.Plugin.Misc.StoreLocator.Controllers" }
            );

        
        }
        public int Priority
        {
            get
            {
                return 0;
            }
        }
    }
}




namespace Nop.Plugin.Misc.StoreLocator
{
    public class StoreLocatorPlugin : BasePlugin, IMiscPlugin
    {
        /// <summary>
        /// Gets a route for plugin configuration
        /// </summary>
        /// <param name="actionName">Action name</param>
        /// <param name="controllerName">Controller name</param>
        /// <param name="routeValues">Route values</param>
        public void GetConfigurationRoute(out string actionName, out string controllerName, out RouteValueDictionary routeValues)
        {
            actionName = "Configure";
            controllerName = "MiscStoreLocator";
            routeValues = new RouteValueDictionary { { "Namespaces", "Nop.Plugin.Misc.StoreLocator.Controllers" }, { "area", null } };
        }
    }


namespace Nop.Plugin.Misc.StoreLocator.Controllers
{
    public class MiscStoreLocatorController: Controller
    {
        private readonly ISettingService _settingService;
        private readonly ILocalizationService _localizationService;


       public MiscStoreLocatorController(ISettingService settingService,
            ILocalizationService localizationService)
        {
            this._settingService = settingService;
            this._localizationService = localizationService;
       }

       [AdminAuthorize]
       [ChildActionOnly]
       public ActionResult Configure()
       {
           var model = new ConfigurationModel();

           return View("Nop.Plugin.Misc.StoreLocator.Views.MiscStoreLocator.Configure", model);
       }

    }
}


@{
    Layout = "";
}
@model ConfigurationModel
@using Nop.Plugin.Misc.StoreLocator.Models;
@using Nop.Web.Framework;
@using (Html.BeginForm())
{
    <table class="adminContent">
        <tr>
            <td colspan="2">
                <b>@T("Plugins.Misc.StoreLocator.Notes")</b>
            </td>
        </tr>
        <tr>
                <td class="adminTitle">
                    @Html.LabelFor(m => m.ApiKey):
                </td>
                <td class="adminData">
                    @Html.EditorFor(m => m.ApiKey)
                    @Html.ValidationMessageFor(m => m.ApiKey)
                </td>
            </tr>
        <tr>
            <td colspan="2" width="100%">
                <button type="submit" name="save" value="save" class="t-button">
                    @T("Admin.Common.Save")</button>
            </td>
        </tr>
    </table>
    
}
Hace 12 años
Any clues anyone? Or at least is there a demo code that I can download to try?
Hace 12 años
Hi,

I'm having the same problem. Anyone else having this problem?

Kind Regards
Hace 12 años
If I comment the below it seems to take me to the configure page. It looks like what ever the Html.Action is doing has a problem in it. I cannot step into this bit of code. anybody know what happens inside this method?

@if (!String.IsNullOrEmpty(Model.ConfigurationActionName))
{
  //  @Html.Action( Model.ConfigurationActionName, Model.ConfigurationControllerName,  Model.ConfigurationRouteValues);
}
Hace 12 años
Still waiting for someone to help on this one?Anybody?
Hace 11 años
Yeah, so I've got the same problem. Has anyone found a solution?

My problem pertains to the Realex payment plugin I'm currently working on. At first I thought the problem is the same as in nop 2.0 Plugin thread, and tried resolving it using the solution in post by 7spikes from that thread, but after some digging it became clear that it's not the same problem. The MVC-ControllerTypeCache.xml file is getting updated, it's just missing the reference to my plugins controller.

Does anyone have eny idea what could be the issue?

The stack trace is here: Stack trace on pastebin.com. I'm on nopCommerce 2.50

The exception is triggered on:

@if (!String.IsNullOrEmpty(Model.ConfigurationActionName))
{
    @Html.Action(Model.ConfigurationActionName, Model.ConfigurationControllerName, Model.ConfigurationRouteValues);
}

which is the first reference to my controller, that cannot be found.
Hace 11 años
Could it be that you have not registered your route correctly?

The url MVC is reporting controller not found for is:

/Admin/Plugin/ConfigureMiscPlugin

but you have registered your route like this:

routes.MapRoute("Plugin.Misc.StoreLocator.Configure",
                 "Plugins/MiscStoreLocator/Configure",
                 new { controller = "MiscStoreLocator", action = "Configure" },
                 new[] { "Nop.Plugin.Misc.StoreLocator.Controllers" }
Hace 11 años
Make sure the razor view is set to embedded resource
Also I have had errors in my plugins because of a misspelling
Hace 11 años
Thanks for the replies. I am positive that my route in RouteProvider was correct and the Views were set to Embedded Resources.  As for misspeling errors... I guess we'll never know. I decided to redo the plugin from scratch, and when I say "from scratch" I mean "take anouther plugin and change its naming and methods". It worked beautifully until yesterday afternoon, when I encountered (unfortunately not for the first time) another issue.

The app works all right on localhost, but not on the server (db in both cases is remote, and it DID work on the server yesterday morning). Unforunately I encountered this problem on localhost too few weeks back and was never able to solve it. I somehow managed to bypass it, but I never truly understood what is was the caused by. I guess I'll have to figure it out now.

Error pastebin is here.

So far I've tried deploying it without my custom plugins (deleted references from \build\nop.plugins.targets), edited InstalledPlugins.txt, removed my custom scheduled tasks, made sure everything was sent to the server correctly and double checked the DB. And now, I'm out of ideas.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.