显示非本布拉科视图,错误"HTTP Error 404.0 - Not Found"



在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视图和控制器吗?

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

或者考虑将控制器封装在RenderMvcController、曲面控制器、局部视图中。。。

最新更新