gpt4 book ai didi

asp.net - “bootstrap”不是有效的脚本名称。名称必须以 '.js' 结尾

转载 作者:行者123 更新时间:2023-12-03 09:23:27 25 4
gpt4 key购买 nike

我正在学习 asp.net,因此我正在尝试从 MSDN 构建名为“Wingtip Toys”的项目。

该项目是在 VS 2013 上开发的,我有 VS 2012。当我尝试按照 here 的指令添加 Bootstrap 时我在浏览器中运行时收到错误。

“/”应用程序中的服务器错误。

'bootstrap' is not a valid script name. The name must end in '.js'.

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

Exception Details: System.InvalidOperationException: 'bootstrap' isnot a valid script name. The name must end in '.js'.

当我在母版页上添加 .js 时,它向我显示另一个错误:

The assembly 'System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' does not contain a Web resource that has the name 'bootstrap.js'. Make sure that the resource name is spelled correctly.

我还将 CSS 文件添加到 Bundle.config,但结果仍然相同。我已经有可用的 NuGet 包,就像 jQuery.js 错误一样,但我还无法解决这个问题。

最佳答案

这对我有用。我将其添加到我的 BundleConfig.cs 文件中:

ScriptManager.ScriptResourceMapping.AddDefinition("bootstrap", new ScriptResourceDefinition
{
Path = "~/scripts/bootstrap.min.js",
DebugPath = "~/scripts/bootstrap.js",
LoadSuccessExpression = "bootstrap"
});

关于asp.net - “bootstrap”不是有效的脚本名称。名称必须以 '.js' 结尾,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26691086/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com