微软捆绑偶尔在部署或开发中返回404 [英] Microsoft bundles return 404 occasionally on deployment or in development

查看:161
本文介绍了微软捆绑偶尔在部署或开发中返回404的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个非常奇怪的情况,好​​几个月了,并没有能够找到一个解决方案。

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

在使用MVC包一个.NET应用程序,我在每个请求创建一个新包,需要包含此请求的脚本和样式。这是工作就好了大部分的时间。
问题是,有时一个干净的部署过程中的发展和更多的时候期间,束请求返回404

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,然后刷新 - 还是404!
重新启动应用程序池 - 还是404!
随机编辑在web.config中 - 还是404!
削减项目的所有文件,然后将其复制回来,然后刷新 - !还是404

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?

在此先感谢

推荐答案

找到它!

只需添加在web.config中以下

Just add the following in web.config

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

这篇关于微软捆绑偶尔在部署或开发中返回404的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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