Reputation: 23
I think i have already read all the related questions here, but sadly i couldn't find an answer yet.
My problem is, locally everything runs fine without errors but when i deploy my website to my server, i'm getting there the following error:
The following sections have been defined but have not been rendered for the layout page >"~/Views/Shared/_Layout.cshtml": "styles"
I'm using Asp.Net MVC 4 with the Razor engine and .Net 4.5.
In _Layout.cshtml
i have the following block defined:
<head>
....
@Styles.Render("~/Content/Css")
@Scripts.Render("~/bundles/modernizr")
@RenderSection("styles", required: false)
</head>
And in Index.cshtml
the following block:
@section styles{
<link rel="stylesheet" href=... />
@Scripts.Render("~/bundles/js/somejs")
}
This is driving me crazy. If this error would also occur on my development machine, i could debug it. But it only happens on my server, locally everything runs fine.
Even other projects with similar code pieces run fine on my server.
Maybe someone has any hints for me?
Upvotes: 2
Views: 3071
Reputation: 1038810
I suspect that the contents of the _Layout.cshtml
or Index.cshtml
on your server is not what you think it is. Maybe the deployed version is different than what you have locally. Deployment went wrong?
Upvotes: 2