나는 다음과 같은 컨트롤러가 있습니다ASP.NET MVC 3 서버 오류
public class ItemController : Controller
{
private SomeDbEntities _db= new SomeDbEntities();
//
// GET: /Item/
public ActionResult Index()
{
var items = _db.Items.ToList();
return View(items);
}
public ActionResult Decription(int id)
{
var item = _db.Items.Single(a => a.ItemID == id);
return View(item);
}
}
2 조회수 :
Index.cshmtl
@model IEnumerable<Web.Models.Item>
@{
ViewBag.Title = "Index";
}
<h2>Index</h2>
<ul>
@foreach (var item in Model)
{
<li>@Html.ActionLink(item.Name, "Description", new { id = item.ItemID})</li>
}
설명. cshtml
@model Web.Models.Item
@{
ViewBag.Title = "Decription";
}
<h2>Decription</h2>
<p>@Model.Description</p>
경로
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Item", action = "Index", id = UrlParameter.Optional }
);
routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
}
그리고 난 내가 서버 오류가 무엇입니까 즉 http://localhost:12952/Item/Description/2
에 도달하려고하면 URL을하면서
HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.
카시니 서버가 실행 중입니까? –
아니요. 일반적인 ASP.NET Web Development Server에서 실행하고 있습니다. – Bip
그건 카시니 ;-) –