显示非Umbraco视图,错误“HTTP错误404.0 - 未找到”

时间:2014-09-15 06:32:21

标签: .net asp.net-mvc-4 umbraco umbraco7 umbraco-mvc

在MVC 4应用程序中,我有Nuget Umbraco CMS 7。

我需要保留一个非Umbraco /自定义控制器的视图。我创建了一个名为Users的MVC控制器,它有一个名为Index的动作。我在web.config中更新了umbracoReservedUrls,如下所示:

<add key="umbracoReservedUrls" value="~/config/splashes/booting.aspx,~/install/default.aspx,~/config/splashes/noNodes.aspx,~/VSEnterpriseHelper.axd,~/Users/Index" />

以下是我的控制器代码:

 public class UsersController : Controller
    {
        //
        // GET: /Users/

        public ActionResult Index(User model)
        {
            return View(model);
        }

    }

我的观点标记如下:

@model Common.Model.User

@{
    ViewBag.Title = "Index";
}

<h2>Index</h2>

问题: 在运行时如果我导航到http://localhost:56512/users/index,控件不会进入控制器,在浏览器中我得到404错误,详情如下:

HTTP Error 404.0 - Not Found
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

您能否指导如何解决此问题并导航到非Umbraco视图和控制器?

1 个答案:

答案 0 :(得分:-1)

将控制器路径放在umbracoReservedPaths而不是UmbracoReservedUrls

或者考虑将控制器包装在RenderMvcController,表面控制器,局部视图中......

相关问题