加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net-mvc – Umbraco 4.11.3 – 控制器类型的当前请求不明确

发布时间:2020-12-16 07:17:10 所属栏目:asp.Net 来源:网络整理
导读:我有一个全新安装的umbraco 4.11.3我正在尝试进行一个简单的控制器测试,但是有些事情对我来说是错误的.我创建了一个没有匹配模板的文档类型“Demo”.然后基于该Document类型调用名为“Demo”的内容项并更改此配置设置(defaultRenderingEngine – MVC)我添加
我有一个全新安装的umbraco 4.11.3我正在尝试进行一个简单的控制器测试,但是有些事情对我来说是错误的.我创建了一个没有匹配模板的文档类型“Demo”.然后基于该Document类型调用名为“Demo”的内容项并更改此配置设置(defaultRenderingEngine – > MVC)我添加了一个带有以下代码的新控制器.

using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Web;
 using System.Web.Mvc;
 using Umbraco.Web.Models;

 namespace FrontEnd.Controllers
 {
    public class DemoController : Umbraco.Web.Mvc.RenderMvcController
   {
    //
    // GET: /Demo/

    public ActionResult Index(RenderModel model)
    {
        return base.Index(model);
    }
    public ActionResult Demo(RenderModel model)
    {
        return View(model);
    }
}
}

我收到此错误:

The current request for action 'Index' on controller type 'DemoController' is ambiguous between the following action methods:
System.Web.Mvc.ActionResult Index(Umbraco.Web.Models.RenderModel) on type FrontEnd.Controllers.DemoController
System.Web.Mvc.ActionResult Index(Umbraco.Web.Models.RenderModel) on type Umbraco.Web.Mvc.RenderMvcController

Exception Details: System.Reflection.AmbiguousMatchException: The current request for action 'Index' on controller type 'DemoController'    
is ambiguous between the following action methods:
System.Web.Mvc.ActionResult Index(Umbraco.Web.Models.RenderModel) on type FrontEnd.Controllers.DemoController
System.Web.Mvc.ActionResult Index(Umbraco.Web.Models.RenderModel) on type Umbraco.Web.Mvc.RenderMvcController

关于在这里做什么的任何想法?

谢谢

解决方法

忘了提供覆盖,

public override ActionResult Index(RenderModel model)
    {
        return base.Index(model);
    }

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读