Is there any way to have a file extension in a bundle name?

折月煮酒 提交于 2019-12-03 10:33:49
Darin Dimitrov

You could add the following to your <system.webServer> section in web.config:

<modules runAllManagedModulesForAllRequests="true" />

This will ensure that requests for static resources such as .js and .css will pass through the managed modules and be intercepted by ASP.NET MVC.

As an alternative to enabling runAllManagedModulesForAllRequests for all requests you could configure them only for the urls you need to use. So inside the <handlers> add the following:

<handlers>
    <!-- ... -->
    <add name="scriptBundle" verb="*" path="script.js" type="System.Web.Optimization.BundleHandler, System.Web.Optimization" preCondition="managedHandler" />
    <add name="cssBundle" verb="*" path="style.css" type="System.Web.Optimization.BundleHandler, System.Web.Optimization" preCondition="managedHandler" />
</handlers>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!