Microsoft bundles return 404 occasionally on deplo

2019-08-31 09:42发布

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条回答
贼婆χ
2楼-- · 2019-08-31 10:00

Found it!!

Just add the following in web.config

<modules>
   <remove name="BundleModule" />
   <add name="BundleModule" type="System.Web.Optimization.BundleModule" />
</modules>
查看更多
登录 后发表回答