對於我的一個類,我剛開始學習如何在ASP.Net MVC5中開發Web應用程序。我們需要做的一件事是重新設計一個簡單的用戶帳戶管理器的視圖,並且已經向我們提供了可供處理和修改的代碼。學習ASP.Net MVC並在'/'應用程序中構建用戶管理器服務器錯誤
問題是,當我真正在Visual Studio中運行代碼時,出現了404錯誤,說Server Error in '/' Application
。
我相當肯定代碼在教室中顯示時工作,但我無法在這裏工作。
這裏的示例代碼,對於那些有興趣:
UserManagerController.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace CS610W6.Controllers
{
public class UserManagerController : Controller
{
//
// GET: /UserManager/
public ActionResult Index()
{
//Use the application's DB context to access the Identity framework's users
var UserList = new CS610W6.Models.ApplicationDbContext().Users.ToList();
//Pass the UserList to the view
return View(UserList);
}
}
}
index.cshtml
@model List<CS610W6.Models.ApplicationUser>
@{
ViewBag.Title = "Index";
}
<h2>Index</h2>
@foreach (var item in Model)
{
@item.UserName<br />
@item.PasswordHash<br />
@item.Id<br />
@Html.ActionLink("Edit", "Edit", new { id = item.Id })
}
編輯:這裏是的全文錯誤,如瀏覽器所示,
'/'應用程序中的服務器錯誤。
無法找到該資源。
說明:HTTP 404。您正在尋找(或它的 一個依賴項)的資源可能已被刪除,更名,或者是 暫時不可用。請檢查以下URL並確定 拼寫正確。
請求的URL:/Views/index.cshtml
版本信息:Microsoft .NET Framework版本:4.0.30319; ASP.NET版本:4.0.30319.34274
加入你的完整錯誤。 –
當你確切地得到錯誤? –