【发布时间】:2016-01-09 10:22:55
【问题描述】:
我有一个基于 MVC 6 的非常简单的解决方案。
ViewComponent -> /ViewComponents/PriorityListViewComponent.cs
public class PriorityListViewComponent : ViewComponent
{
public IViewComponentResult Invoke(int maxPriority)
{
return View();
}
}
“部分”视图/Views/Components/PriorityList/Default.cshtml
Empty view
查看/Views/Shared/Index.cshtml
@{
Layout = "~/Views/Shared/BaseView.cshtml";
}
@Component.Invoke("PriorityList", 1)
上面返回一个 HTTP 500 错误,我不知道为什么。我认为所有关于路径的规则都得到了遵守。
【问题讨论】:
标签: c# asp.net-core asp.net-core-viewcomponent