Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net mvc 已为布局页定义节,但未呈现~/视图/Shared/_Layout.cshtml";:&引用;标题「;_Asp.net Mvc_Asp.net Mvc 4 - Fatal编程技术网

Asp.net mvc 已为布局页定义节,但未呈现~/视图/Shared/_Layout.cshtml";:&引用;标题「;

Asp.net mvc 已为布局页定义节,但未呈现~/视图/Shared/_Layout.cshtml";:&引用;标题「;,asp.net-mvc,asp.net-mvc-4,Asp.net Mvc,Asp.net Mvc 4,我创建了一个新的MVC4互联网应用程序。我只是在学习ASP.NETMVC4中的一本书。本章介绍了Ajax是MVC中的ASP.NET。 索引的视图如下所示 @section head{ <script type ="text/javascript" src="@Url.Content("~/Scripts/AjaxDemo.js")"></script> } @Html.ActionLink("Show the privacy polic

我创建了一个新的MVC4互联网应用程序。我只是在学习ASP.NETMVC4中的一本书。本章介绍了Ajax是MVC中的ASP.NET。 索引的视图如下所示

@section head{
    <script type ="text/javascript"

            src="@Url.Content("~/Scripts/AjaxDemo.js")"></script>
}

@Html.ActionLink("Show the privacy policy", "PrivacyPolicy", null, new{id="privacyLink"})

<div id="privacy"></div>
现在,当我运行此应用程序并手动将链接设置为
http://localhost:19208/customajax

我听到一个错误的说法

The following sections have been defined but have not been rendered for the layout page "~/Views/Shared/_Layout.cshtml": "head".

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Web.HttpException: The following sections have been defined but have not been rendered for the layout page "~/Views/Shared/_Layout.cshtml": "head".
知道我在这里犯了什么错吗

\u Layout.cshtml
是默认设置,我没有对它做任何更改

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title>@ViewBag.Title - My ASP.NET MVC Application</title>
        <link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
        <meta name="viewport" content="width=device-width" />
        @Styles.Render("~/Content/css")
        @Scripts.Render("~/bundles/modernizr")

    </head>
    <body>
        <header>
            <div class="content-wrapper">
                <div class="float-left">
                    <p class="site-title">@Html.ActionLink("your logo here", "Index", "Home")</p>
                </div>
                <div class="float-right">
                    <section id="login">
                        @Html.Partial("_LoginPartial")
                    </section>
                    <nav>
                        <ul id="menu">
                            <li>@Html.ActionLink("Home", "Index", "Home")</li>
                            <li>@Html.ActionLink("About", "About", "Home")</li>
                            <li>@Html.ActionLink("Contact", "Contact", "Home")</li>
                        </ul>
                    </nav>
                </div>
            </div>
        </header>
        <div id="body">
            @RenderSection("featured", required: false)
            <section class="content-wrapper main-content clear-fix">
                @RenderBody()
            </section>
        </div>
        <footer>
            <div class="content-wrapper">
                <div class="float-left">
                    <p>&copy; @DateTime.Now.Year - My ASP.NET MVC Application</p>
                </div>
            </div>
        </footer>

        @Scripts.Render("~/bundles/jquery")
        @RenderSection("scripts", required: false)
    </body>
</html>

@Title-我的ASP.NET MVC应用程序
@style.Render(“~/Content/css”)
@Scripts.Render(“~/bundles/modernizer”)

@Html.ActionLink(“您的徽标在此”、“索引”、“主页”)

@Html.Partial(“_LoginPartial”)
  • @ActionLink(“主页”、“索引”、“主页”)
  • @ActionLink(“关于”、“关于”、“主页”)
  • @ActionLink(“联系人”、“联系人”、“主页”)
@渲染部分(“特色”,必填项:false) @RenderBody() &抄袭@DateTime.Now.Year-我的ASP.NET MVC应用程序

@Scripts.Render(“~/bundles/jquery”) @RenderSection(“脚本”,必需:false)
您尚未在
\u Layout.cshtml

您只需要在
\u Layout.cshtml

作为


@渲染部分(“头部”,必填项:false)
The following sections have been defined but have not been rendered for the layout page "~/Views/Shared/_Layout.cshtml": "head".

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Web.HttpException: The following sections have been defined but have not been rendered for the layout page "~/Views/Shared/_Layout.cshtml": "head".
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title>@ViewBag.Title - My ASP.NET MVC Application</title>
        <link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
        <meta name="viewport" content="width=device-width" />
        @Styles.Render("~/Content/css")
        @Scripts.Render("~/bundles/modernizr")

    </head>
    <body>
        <header>
            <div class="content-wrapper">
                <div class="float-left">
                    <p class="site-title">@Html.ActionLink("your logo here", "Index", "Home")</p>
                </div>
                <div class="float-right">
                    <section id="login">
                        @Html.Partial("_LoginPartial")
                    </section>
                    <nav>
                        <ul id="menu">
                            <li>@Html.ActionLink("Home", "Index", "Home")</li>
                            <li>@Html.ActionLink("About", "About", "Home")</li>
                            <li>@Html.ActionLink("Contact", "Contact", "Home")</li>
                        </ul>
                    </nav>
                </div>
            </div>
        </header>
        <div id="body">
            @RenderSection("featured", required: false)
            <section class="content-wrapper main-content clear-fix">
                @RenderBody()
            </section>
        </div>
        <footer>
            <div class="content-wrapper">
                <div class="float-left">
                    <p>&copy; @DateTime.Now.Year - My ASP.NET MVC Application</p>
                </div>
            </div>
        </footer>

        @Scripts.Render("~/bundles/jquery")
        @RenderSection("scripts", required: false)
    </body>
</html>
<head>
    @RenderSection("head", required: false)
</head>