MVC4风格捆绑给403风格

2023-09-03 09:53:30 作者:为谁画相思

在捆绑/缩小时启用,我的一些捆绑似乎有一个无效的URL在浏览器中(与结尾/)和IIS提供了一个403 Forbidden错误,好像试图列出文件夹中的内容。

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.

推荐答案

我的包被登记为它对应的是实际的文件夹的解决方案的路径,例如: 〜/内容/论坛

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.

 
精彩推荐
图片推荐