MVC4 样式包提供 403 [英] MVC4 style bundle giving 403
问题描述
启用捆绑/缩小后,我的某些捆绑包在浏览器中似乎具有无效的 URL(以/结尾),并且 IIS 给出了 403 禁止错误,就像试图列出文件夹的内容一样.
When bundling/minification is enabled, some of my bundles seem to have an invalid URL in the browser (ending with a /), and IIS gives a 403 forbidden error, as if trying to list a folder's contents.
我的包的设置方式没有区别 - 它们不是 .min.css,访问权限是正确的等等.
There's no difference in the way my bundles are set up - they are not .min.css, access permissions are correct etc.
推荐答案
我的包被注册为对应于解决方案上实际文件夹的路径,例如~/Content/forum
.
My bundles were registered as paths which corresponded to an actual folder on the solution, e.g. ~/Content/forum
.
这在捆绑关闭时工作正常(捆绑正确包含!),但在启用捆绑时不起作用.
This works fine when bundling is turned off (the bundle is included correctly!), but not when bundling is enabled.
解决方案是将捆绑包的注册名称更改为与文件系统中存在的任何名称不同.
The solution is to change the registered name of the bundle to not be the same as anything that exists in the file system.
这篇关于MVC4 样式包提供 403的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!