【问题标题】:The controller for path '/Admin/Widget/ConfigureWidget' was not found or does not implement IController找不到路径“/Admin/Widget/ConfigureWidget”的控制器或未实现 IController
【发布时间】:2014-12-07 23:24:50
【问题描述】:

我有一个 Nopcommerce 3.30(带有源代码)项目,并且我已经配置了我自己的 Widget 插件。当我安装它并尝试在'../Admin/Widget/List'中配置它时,出现以下错误:

找不到路径“/Admin/Widget/ConfigureWidget”的控制器 或者不实现 IController。

描述:执行过程中发生了未处理的异常 当前的网络请求。请查看堆栈跟踪以获取更多信息 有关错误的信息以及它在代码中的来源。

异常详细信息:System.Web.HttpException:路径的控制器 '/Admin/Widget/ConfigureWidget' 未找到或未实现 控制器。

来源错误:

Line 12: @if (!String.IsNullOrEmpty(Model.ConfigurationActionName))
Line 13: {
Line 14:     @Html.Action(Model.ConfigurationActionName, Model.ConfigurationControllerName, Model.ConfigurationRouteValues);
Line 15: }
Line 16: else

插件控制器:

using System.Web.Mvc;
using Nop.Core;
using Nop.Core.Caching;
using Nop.Plugin.Widgets.ApplicationNotes.Infrastructure.Cache;
using Nop.Plugin.Widgets.ApplicationNotes.Models;
using Nop.Services.Configuration;
using Nop.Services.Media;
using Nop.Services.Stores;
using Nop.Web.Framework.Controllers;

namespace Nop.Plugin.Widgets.ApplicationNotes.Controllers
{
    class WidgetsApplicationNotesController : BasePluginController
    {

                private readonly IWorkContext _workContext;
        private readonly IStoreContext _storeContext;
        private readonly IStoreService _storeService;
        private readonly IPictureService _pictureService;
        private readonly ISettingService _settingService;
        private readonly ICacheManager _cacheManager;

        public WidgetsApplicationNotesController(IWorkContext workContext,
            IStoreContext storeContext,
            IStoreService storeService, 
            IPictureService pictureService,
            ISettingService settingService,
            ICacheManager cacheManager)
        {
            this._workContext = workContext;
            this._storeContext = storeContext;
            this._storeService = storeService;
            this._pictureService = pictureService;
            this._settingService = settingService;
            this._cacheManager = cacheManager;
        }

这是我的插件类

using Nop.Core;
using Nop.Core.Plugins;
using Nop.Services.Cms;
using Nop.Services.Configuration;
using Nop.Services.Localization;
using Nop.Services.Media;
using System.Collections.Generic;
using System.IO;
using System.Web.Routing;

namespace Nop.Plugin.Widgets.ApplicationNotes
{
    public class ApplicationNotesPlugin: BasePlugin, IWidgetPlugin
    {

        private readonly IPictureService _pictureService;
        private readonly ISettingService _settingService;
        private readonly IWebHelper _webHelper;

        public ApplicationNotesPlugin(IPictureService pictureService, 
            ISettingService settingService, IWebHelper webHelper)
        {
            this._pictureService = pictureService;
            this._settingService = settingService;
            this._webHelper = webHelper;
        }

        /// <summary>
        /// Gets widget zones where this widget should be rendered
        /// </summary>
        /// <returns>Widget zones</returns>
        public IList<string> GetWidgetZones()
        {
            return new List<string>() { "home_page_top" };
        }

我不明白错误的根源是什么。 谢谢

【问题讨论】:

  • 你能给我控制器代码吗?控制器主要方法是指公共基础控制器
  • 请给我您的控制器详细信息,例如“公共类 HomeController”
  • 如果你提到插件控制器,这是我插件的控制器。
  • 是的,我想要它的全部细节,所以你可以只提供公共类 yourcontroller:basecontroller
  • 好的,我可以为您提供更多有用的信息吗?

标签: c# asp.net-mvc asp.net-mvc-4 nopcommerce


【解决方案1】:

我没有意识到我的控制器不是公开的:

class WidgetsApplicationNotesController : BasePluginController

【讨论】:

  • 经过一整天的调试,这个简单的答案解决了我的问题!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2012-12-10
  • 2013-05-31
  • 1970-01-01
  • 2016-11-26
  • 1970-01-01
  • 2020-07-20
相关资源
最近更新 更多