Microsoft bundles return 404 occasionally on deployment or in development

泄露秘密 提交于 2019-12-13 06:49:17

问题


I have a really weird situation, for months now, and not being able to find a solution.

In a .net application using mvc bundles, i create a new bundle in every request, containing the scripts and styles needed for this request. This is working just fine most of the time. The problem is that sometimes during development and more often during a clean deployment, the bundle requests return 404.

When this bug occurs (can't reproduce it) i try the following:

IISReset and then refresh - still 404! Restart application pool - still 404! Random edit in web.config - still 404! Cut all files of the project and then copy them back, then refresh - still 404!

Cut all files of the project, refresh page to generate error due to empty folder and then copy the cut files back - fixed!

Editing Compilation element with debug=false, refresh page, and then debug=true again - fixed!

As you see this doesn't make any sense! Any ideas, anyone?

thanks in advance


回答1:


Found it!!

Just add the following in web.config

<modules>
   <remove name="BundleModule" />
   <add name="BundleModule" type="System.Web.Optimization.BundleModule" />
</modules>


来源:https://stackoverflow.com/questions/24686495/microsoft-bundles-return-404-occasionally-on-deployment-or-in-development

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!