gpt4 book ai didi

asp.net-mvc - Umbraco 4.11.3 - 当前对 Controller 类型的请求不明确

转载 作者:行者123 更新时间:2023-12-01 19:39:54 26 4
gpt4 key购买 nike

我全新安装了 umbraco 4.11.3,我正在尝试使用 进行简单的 Controller 测试,但出现了一些问题。我创建了一个文档类型“演示”,但没有匹配的模板。然后,基于该文档类型的名为“Demo”的内容项并更改此配置设置(defaultRenderingEngine --> MVC),我使用下面的代码添加了一个新 Controller 。

 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);
}

关于asp.net-mvc - Umbraco 4.11.3 - 当前对 Controller 类型的请求不明确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14369640/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com