简体   繁体   English

@Scripts.Render()<script> tag links to a Html source code page, and scripts are not detected

[英]@Scripts.Render() <script> tag links to a Html source code page, and scripts are not detected

Here is where i include the ScriptBundle:这是我包含 ScriptBundle 的地方:

bundles.Add(new ScriptBundle("~/scripts").Include(
                    "~/Scripts/jquery.js", "~/Scripts/popper.js",
                    "~/Scripts/bootstrap.js", "~/Scripts/Index.js"));

When i debbug the application the script tags are rendered separately, and it works well.当我调试应用程序时,脚本标签是单独呈现的,并且运行良好。 The problem is when i publish the project, the scripts are rendered in a single tag;问题是当我发布项目时,脚本呈现在单个标签中; i know that AspNet compress all the scripts in a single tag, but the web page does not detect the scripts and when i click on the link of the rendered tag, it directs me to a source code page (HTML) in which the scripts should be.我知道 AspNet 将所有脚本压缩在一个标签中,但是网页没有检测到脚本,当我点击呈现标签的链接时,它会将我定向到一个源代码页 (HTML),脚本应该在其中是。

This is the tag:这是标签:

<script src="/scripts?v=r8NL2JoYrRk4WG4L8aUu1037yymdncGQgFxOAcbEyw41"></script>

And this is the link: script_tag_link这是链接: script_tag_link

Here is how the page of the link looks: Here should be the compressed scripts以下是链接页面的外观:这里应该是压缩脚本

The ScriptBundle name, in this case "~/scripts", shouldn't match an existing folder in your application. ScriptBundle 名称(在本例中为“~/scripts”)不应与应用程序中的现有文件夹匹配。 Try changing it to "~/bundles".尝试将其更改为“~/bundles”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Scripts.Render无法正常工作 - Scripts.Render is not working Scripts.Render显示包名称而不是文件? - Scripts.Render displaying the bundle name and not the files? 是否可以从ASPX文件的代码中调用Scripts.Render或Styles.Render? - Is it possible to call Scripts.Render or Styles.Render from the code behind of an ASPX file? 尽管有Scripts.Render命令,Razor使用它生成jQuery太晚了 - Razor generates jQuery too late for custom script using it despite Scripts.Render order c#类中的Scripts.Render(创建html帮助器)。 在C#文件中使用HtmlHelper中的函数 - Scripts.Render in c# class (creating html helper). Using functions from HtmlHelper in c# file MVC5 对象引用未设置为 Scripts.Render 上的对象实例 - MVC5 Object reference not set to an instance of an object on Scripts.Render 使用捆绑包时,无法在Scripts.Render中生成“ VersionQueryString” - Unable to generate 'VersionQueryString' in Scripts.Render when using bundle Scripts.Render 抛出“对象未设置为对象的实例”错误 - Scripts.Render throwing 'Object not set to an instance of an object' error 如何在.Net Core 2.0 MVC应用程序中使用@ Scripts.Render? - How can I use @Scripts.Render with .Net Core 2.0 MVC application? 调用所有脚本后,如何获取页面的html源? - How to get html source of page, after all it scripts was called?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM