我正在使用BForms编写MVC 5.1应用程序。
我已经使用了本页中教导的内容:http://bforms.veritech.io/Start/Setup#example
之后,当我加载页面时,会发生以下错误:找不到RequireJS配置
这是错误的一部分(第72行标记为红色:
Línea 70: @if (HttpContext.Current.IsDebuggingEnabled)
Línea 71: {
Línea 72: @Html.RenderRequireJsSetup(Url.Content("~/Scripts"),
Línea 73: Url.Content("~/Scripts/BForms/Components/RequireJS/require.js"),
Línea 74: new[]
我已经检查过所有路径都是正确的,这就是为什么我不知道错误在哪里。
这是完整的布局页面:
@using BForms.Html
@using RequireJS
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>@ViewBag.Title - Gestión de Incidencias</title>
<link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
<meta name="viewport"
content="initial-scale=1,
width=device-width,
maximum-scale=1,
user-scalable=no">
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
@*For IE7-8 support of HTML5 elements and responsive*@
<!--[if lt IE 9]>
<script src="@Url.Content("~/Scripts/BForms/Bundles/iefix.js")"
type="text/javascript">
</script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="masthead">
<ul class="nav nav-justified">
<li><a href="@Url.Action("Index", "Home")">
<img src="@Url.Content("~/Images/desktop.png")" alt="Escritorio" title="Escritorio" /><br />
Escritorio
</a>
</li>
<li><a href="@Url.Action("Index", "Incidencia")">
<img src="@Url.Content("~/Images/events.png")" alt="Incidencias" title="Incidencias" /><br />
Incidencias
</a>
</li>
<li><a href="@Url.Action("Agregar", "Incidencia")">
<img src="@Url.Content("~/Images/add_event.png")" alt="Agregar Incidencia" title="Agregar Incidencia" /><br />
Agregar Incidencia
</a>
</li>
<li><a href="@Url.Action("Index", "Backend")">
<img src="@Url.Content("~/Images/backend.png")" alt="Escritorio" title="Escritorio" /><br />
Administración
</a>
</li>
<li><a href="@Url.Action("Index", "Reporte")">
<img src="@Url.Content("~/Images/reports.png")" alt="Escritorio" title="Escritorio" /><br />
Reportes
</a>
</li>
</ul>
</div>
</div>
<div class="container body-content">
@RenderBody()
<hr />
<footer>
<p>© @DateTime.Now.Year - BTres Networks - Todos los derechos reservados</p>
</footer>
</div>
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
@Scripts.Render("~/bundles/BFormsJS")
@RenderSection("scripts", required: false)
@if (HttpContext.Current.IsDebuggingEnabled)
{
@Html.RenderRequireJsSetup(Url.Content("~/Scripts"),
Url.Content("~/Scripts/BForms/Components/RequireJS/require.js"),
new[]
{
"~/Scripts/BForms/RequireJS.config"
})
}
else
{
@Html.RenderRequireJsSetup(Url.Content("~/Scripts"),
Url.Content("~/Scripts/BForms/Components/RequireJS/require.js"),
new[]
{
"~/Scripts/BForms/RequireJS.Release.config"
})
}
</body>
</html>
请帮忙吗? 感谢
编辑: 我使用了@ Server.MapPath(&#34;〜/ Scripts / BForms / RequireJS.config&#34;)并且它正确显示了文件的物理路径,因此,配置文件实际上位于该位置。
答案 0 :(得分:0)
最后,我已将配置文件移动到项目根目录,并删除了RenderRequireJsSetup的第三个参数,并且它有效。这可能是一个RequireJS错误吗?