I published a site that is in MVC4 at this address. link
When trying to access I get this error message:
"Value can not be null or empty. Parameter name: contentPath"
Line where the error occurs:
@RenderSection("Styles", required: false)
What is the reason for this error?
The site works normally in the local environment.
This section is declared in only a few pages that may have other optional style files.
@section Styles {
@Styles.Render("~/styles/chosen")
@Styles.Render("~/styles/datetimepicker")
}
So it is marked in the _Layout.cshtml file as "required: false"
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title</title>
@Styles.Render("~/styles/css")
@Scripts.Render("~/bundles/modernizr")
@RenderSection("Styles", required: false)
</head>
BuddleConfig
public static void RegisterBundles(BundleCollection bundles)
{
//JS
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery.validate.js"));
// Use the development version of Modernizr to develop with and learn from. Then, when you're
// ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
"~/Scripts/modernizr-*"));
bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
"~/Scripts/bootstrap.js",
"~/Scripts/respond.js"));
bundles.Add(new ScriptBundle("~/bundles/mask").Include(
"~/Scripts/jquery.mask.js"));
bundles.Add(new ScriptBundle("~/bundles/maskMoney").Include(
"~/Scripts/jquery.maskMoney.min.js"));
bundles.Add(new ScriptBundle("~/bundles/chosen").Include(
"~/Scripts/chosen.jquery.js",
"~/Scripts/chosen.proto.js"));
bundles.Add(new ScriptBundle("~/bundles/datetimepicker").Include(
"~/Scripts/jquery.datetimepicker.full.min.js",
"~/Scripts/datepicker-pt-BR.js"));
bundles.Add(new ScriptBundle("~/bundles/digitalClock").Include(
"~/Scripts/digitalClock.js"));
bundles.Add(new ScriptBundle("~/bundles/msgBox").Include(
"~/Scripts/messagebox.min.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
"~/Scripts/jquery-ui.min.js"));
bundles.Add(new ScriptBundle("~/bundles/moment").Include(
"~/Scripts/moment.min.js",
"~/Scripts/moment-with-locales.min.js"));
//ESTILOS CSS
bundles.Add(new StyleBundle("~/styles/css").Include(
"~/Content/bootstrap.css",
"~/Content/site.css"));
bundles.Add(new StyleBundle("~/styles/chosen").Include(
"~/Content/chosen.css"));
bundles.Add(new StyleBundle("~/styles/datetimepicker").Include(
"~/Content/jquery.datetimepicker.min.css"));
bundles.Add(new StyleBundle("~/styles/digitalClock").Include(
"~/Content/clock.css"));
bundles.Add(new StyleBundle("~/styles/msgBox").Include(
"~/Content/messagebox.css"));
bundles.Add(new StyleBundle("~/styles/jqueryui").Include(
"~/Content/jquery-ui/jquery-ui.min.css",
"~/Content/jquery-ui/jquery-ui.structure.min.css",
"~/Content/jquery-ui/jquery-ui.theme.min.css"));
}
_Layout.cshtml
@using ControleHoras.APRESENTACAO.Models
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title</title>
@Styles.Render("~/styles/css")
@Scripts.Render("~/bundles/modernizr")
@Styles.Render("~/styles/chosen")
@Styles.Render("~/styles/datetimepicker")
@Styles.Render("~/styles/digitalClock")
</head>
<body>
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="@Url.Action("Index", "Home")">
<img src="@Url.Content(System.Configuration.ConfigurationManager.AppSettings["logo"])" alt="" style="border: none; width: 150px; height: 50px;" />
</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
@if (Session["usuario"] != null)
{
<ul class="nav navbar-nav">
@{
if (Session["usuario"] != null)
{
var usuario = (UsuarioViewModel)Session["usuario"];
if (usuario.ClienteID.HasValue && usuario.ClienteID.Value > 0)
{
@*<li>@Html.ActionLink("Horas Extras", "HorasExtras", "Login")</li>*@
}
if (usuario.ProfissionalID.HasValue && usuario.ProfissionalID.Value > 0)
{
<li>@Html.ActionLink("Lançamentos", "Lancamento", "Login")</li>
<li>@Html.ActionLink("Relatórios de Horas", "RelatorioHoras", "Relatorio")</li>
}
if (usuario.Adm)
{
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Clientes<span class="caret"></span></a>
<ul class="dropdown-menu">
<li>@Html.ActionLink("Cadastro", "Search", "Cliente")</li>
<li>@Html.ActionLink("Configurações de Rede", "Index", "ClienteIp")</li>
<li>@Html.ActionLink("Loalização", "Index", "ClienteLocal")</li>
</ul>
</li>
<li>@Html.ActionLink("Contratos", "Contrato", "Login")</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Profissional<span class="caret"></span></a>
<ul class="dropdown-menu">
<li>@Html.ActionLink("Cadastro", "Search", "Profissional")</li>
<li>@Html.ActionLink("Dispositivos Móveis", "Index", "ProfissionalDispositivo")</li>
</ul>
</li>
<li>@Html.ActionLink("Lançamentos", "Lancamento", "Login")</li>
<li>@Html.ActionLink("Usuários", "Usuario", "Login")</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Relatórios<span class="caret"></span></a>
<ul class="dropdown-menu">
<li>@Html.ActionLink("Relatórios de Horas", "RelatorioHoras", "Relatorio")</li>
<li>@Html.ActionLink("Demonstrativo de Horas", "DemonstrativoHoras", "Relatorio")</li>
<li>@Html.ActionLink("Relatório de Faturamento", "RelatorioFaturamento", "Relatorio")</li>
<li>@Html.ActionLink("Acompanhamento Diário de Lançamentos", "AcompanhamentoDiario", "Relatorio")</li>
</ul>
</li>
}
}
}
</ul>
<ul class="nav navbar-nav navbar-right">
<li class="active">@Html.ActionLink("Sair", "Logout", "Login")</li>
</ul>
}
</div><!--/.nav-collapse -->
</div>
</nav>
<div class="container body-content">
@RenderBody()
</div>
<footer class="rodape">
<p>© @DateTime.Now.Year @System.Configuration.ConfigurationManager.AppSettings["empresa"] </p>
</footer>
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
<!--MessageBox-->
@Scripts.Render("~/bundles/msgBox")
@Styles.Render("~/styles/msgBox")
<!--Jquery UI-->
@Scripts.Render("~/bundles/jqueryui")
@Styles.Render("~/styles/jqueryui")
@RenderSection("scripts", required: false)
</body>
</html>