错误找不到视图MVC4 c#

时间:2014-11-03 10:28:40

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

嗨我做了这个protal工作得很好,但是当我意识到这个到现场网站时我得到一个错误说:

   Message: The view 'EditRole' or its master was not found or no view engine supports the searched locations. The following locations were searched: ~/Areas/Admin/Views/Users/EditRole.aspx  
 ~/Areas/Admin/Views/Users/EditRole.ascx ~/Areas/Admin/Views/Shared/EditRole.aspx   
~/Areas/Admin/Views/Shared/EditRole.ascx ~/Views/Users/EditRole.aspx ~/Views/Users/EditRole.ascx 
~/Views/Shared/EditRole.aspx ~/Views/Shared/EditRole.ascx ~/Areas/Admin/Views/Users/EditRole.cshtml 
~/Areas/Admin/Views/Users/EditRole.vbhtml ~/Areas/Admin/Views/Shared/EditRole.cshtml 
~/Areas/Admin/Views/Shared/EditRole.vbhtml ~/Views/Users/EditRole.cshtml 
~/Views/Users/EditRole.vbhtml ~/Views/Shared/EditRole.cshtml ~/Views/Shared/EditRole.vbhtml
Source: System.Web.Mvc

我的cshtml代码:

     <td>@Html.ActionLink("Edit Roles", "EditRole", "Users", new { roleId = r.RoleID }, new { @class = "action" }) </td>

控制器:

         [HttpPost]
    public ActionResult EditRole(Role role)
    {
        try
        {
            if (ModelState.IsValid)
            {         
            }
            return RedirectToAction("EditRole");
        }
        catch
        {
            return RedirectToAction("EditRole");
        }
    }

问题是,当我在本地主机上运行它时一切正常!但是当我把它放在服务器上时它会给我错误。

有什么想法吗?

错误中注意到的一件事是,它说:

 The following locations were searched: ~/Areas/Admin/Views/Users/EditRole.aspx

但它应该是,EditRole.cshtml 但是我不知道为什么在没有这样的事情时会说EditRole.aspx。

0 个答案:

没有答案