是否需要任何其他配置才能使 MVC 站点在 Visual Studio 2012 中工作?我有一个非常基本的网站设置,但它不工作。它表示错误,但表示模型。
控制器
public class ISPLinkController : Controller
{
// GET: /ISPLink/Details/5
public Models.test Details(int id)
{
return new Models.test { url = "www.google.com", productGroup = "blah", name = "blah" };
}
}
模型
public class test
{
public string name { get; set; }
public string url { get; set; }
public string productGroup { get; set; }
}
看法
@model StopAtNothingAdmin.Models.test
@{
ViewBag.Title = "Details";
}
<h2>Details</h2>
<fieldset>
<legend>test</legend>
<div class="display-label">
@Html.DisplayNameFor(model => model.name)
....Snip
进行http://localhost:57608/ISPLink/Details/5
StopAtNothingAdmin.Models.test
(即查看源代码)。没有别的了