我有一个Nopcommerce 3.30(带源代码)项目,我已经配置了自己的Widget插件。当我安装它并且我试图在'../Admin/Widget/List'中配置它时,出现以下错误:
找不到路径'/ Admin / Widget / ConfigureWidget'的控制器 或者没有实现IController。
描述:执行期间发生了未处理的异常 当前的网络请求。请查看堆栈跟踪了解更多信息 有关错误的信息以及它在代码中的起源。
异常详细信息:System.Web.HttpException:路径的控制器 '/ Admin / Widget / ConfigureWidget'未找到或未实现 一个IController。
来源错误:
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" };
}
我不明白错误的来源是什么。 感谢
答案 0 :(得分:1)
我没有意识到我的控制器不公开:
class WidgetsApplicationNotesController : BasePluginController