MVC捆绑软件不适用于发行版配置(Debug为False),CSS和JS无法加载 [英] MVC Bundle not working with Release Configuration (Debug is False), CSS and JS not loading

查看:72
本文介绍了MVC捆绑软件不适用于发行版配置(Debug为False),CSS和JS无法加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用发布模式发布MVC.Net应用程序时,以下设置将在web.config文件中提供.

When I release MVC.Net application using release mode, the below setting will be available in the web.config file.

<compilation debug="false" targetFramework="4.5" />

执行上述操作时,加载CSS和JavaScript和开发人员工具的网站将显示一堆返回404错误的URL包.

When we do the above, the site loaded with CSS and JavaScript and developer tools show the bunch of URL bundles returning 404 errors.

我还尝试了以下代码,这些代码也未加载脚本和样式表.

I have also tried the below code which also not loading the script and style sheets.

BundleTable.EnableOptimizations = true;

有人可以帮助我解决此问题吗?由于上述问题,我的应用程序正在运行脚本和CSS文件的缓存问题.我的每个新发行版都必须要求客户清除浏览器缓存,以确保新功能正常运行.

Can someone help me fix this issue? Due to the above issues, my application is running into Caching issue with script and CSS file. Each of my new releases, I have to ask my customers to clear the browser cache to make sure that new functionalities are working fine.

推荐答案

检查文件是否正确包含在要部署的解决方案中(右键单击文件并选择属性).

Check that the files are included correctly in the solution to be deployed (right click on the file and select properties).

这篇关于MVC捆绑软件不适用于发行版配置(Debug为False),CSS和JS无法加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆