prevent从通过ASP.NET管道提供静态文件IIS [英] Prevent IIS from serving static files through ASP.NET pipeline

查看:114
本文介绍了prevent从通过ASP.NET管道提供静态文件IIS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于我的CSS的要求,JS,图像文件正在通过ASP.NET管道服务。我以为IIS默认情况下避免这一点,但我看到我的 Application_AuthenticateRequest 断点的请求,没有必要以实际验证这些请求。我已经看到了冲突的方法来改变这种行为 - 什么是做到这一点的最好办法

Requests for my css, js, image files are being served through the ASP.NET pipeline. I thought IIS by default avoided this, but I see the requests on my Application_AuthenticateRequest breakpoint and there's no need to actually authenticate those requests. I've seen conflicting approaches to change this behavior - What is the best way to do this?

推荐答案

我在这里采取了猜测和怀疑,您有以下设置在配置的web.config 文件:

I'm taking a guess here and suspect that you have the following setting configured in your web.config file:

<modules runAllManagedModulesForAllRequests="true">

这意味着,每一个要求,包括对静态内容的击球管道。

This means that every request, including those for static content is hitting the pipeline.

此设置更改为:

<modules runAllManagedModulesForAllRequests="false">

这是假设你的应用程序是ASP.NET 4.0和MVC3下运行。

This is assuming your application is running under ASP.NET 4.0 and MVC3.

对于这个工作,你需要安装 KB980368 (需要重新启动)或Windows 2008 R2 SP1(其中包括此修复程序)。这样做的原因是这个优秀的文章中解释:

For this to work you need to install KB980368 (requires a reboot) or Windows 2008R2 SP1 (which includes this hotfix). The reason for this is explained in this excellent article:

<一个href=\"http://blogs.msdn.com/b/tmarq/archive/2010/04/01/asp-net-4-0-enables-routing-of-extensionless-urls-without-impacting-static-requests.aspx\">How ASP.NET MVC路由工程及其对静态请求的性能

这篇关于prevent从通过ASP.NET管道提供静态文件IIS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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