由于 Razor 脚本标记,完整标识脚手架失败
Full identity scaffolding fails because of Razor script tag
我搭建了所有 Razor 视图,因为我想编辑它们。
但是其中一些在底部有这个:
@section Scripts {
<partial name="_ValidationScriptsPartial" />
}
这是我得到的错误:
InvalidOperationException: The following sections have been defined but have not been rendered by the page at '/Areas/Identity/Pages/Account/Manage/_Layout.cshtml': 'Scripts'. To ignore an unrendered section call IgnoreSection("sectionName").
请注意,我确实希望呈现这些脚本。为什么会崩溃?如何最好地解决它?
参考这个thread。
It means that you have defined a section in your master Layout.cshtml, but you have not included anything for that section in your View.
在您的 /Areas/Identity/Pages/Account/Manage/_Layout.cshtml
中,它应该包含代码:
@section Scripts
{
@RenderSection("Scripts", required: false)
}
我搭建了所有 Razor 视图,因为我想编辑它们。
但是其中一些在底部有这个:
@section Scripts {
<partial name="_ValidationScriptsPartial" />
}
这是我得到的错误:
InvalidOperationException: The following sections have been defined but have not been rendered by the page at '/Areas/Identity/Pages/Account/Manage/_Layout.cshtml': 'Scripts'. To ignore an unrendered section call IgnoreSection("sectionName").
请注意,我确实希望呈现这些脚本。为什么会崩溃?如何最好地解决它?
参考这个thread。
It means that you have defined a section in your master Layout.cshtml, but you have not included anything for that section in your View.
在您的 /Areas/Identity/Pages/Account/Manage/_Layout.cshtml
中,它应该包含代码:
@section Scripts
{
@RenderSection("Scripts", required: false)
}