BeginRequest fires for static files in ASP.NET MVC app

前端 未结 4 1182
庸人自扰
庸人自扰 2021-01-05 23:18

I was under the impression that static files (CSS, images, @font-face files, etc) bypassed ASP.NET completely, and were served directly by IIS.

However, my BeginRe

4条回答
  •  既然无缘
    2021-01-06 00:16

    I believe a default ASP.NET MVC site has this set in the web.config.

      
    

    This means every .NET module will be loaded for every IIS request. This is required for ASP.NET MVC to handle extension-less routing. It's essentially a wildcard mapping that you would write in IIS that would match everything and route it to ASP.NET that lives in the web.config.

    Read more here, including a way to disable the behavior if you aren't using .NET 4.0. It is nasty, but it's the cleanest solution for sites that can't deal with the overhead of having static files served by asp.net.

提交回复
热议问题