当文件不存在时,不会调用静态图像的 HttpHandler
我有处理 jpg 文件的 httpHandler 。当对 jpg 图像的请求到达服务器时,它将被转发到处理程序。在我为谷歌页面速度规则实现指纹打印之前,这工作得很好。
现在它被调用 http://static2.localnatamam.com/Uploaded/Image/Image_Haroon_ur_Rasheed_78。 jpg
但不适用于
第一个文件存在于目录中,但第二个文件不存在,因为第二个 URL 是指纹打印的,我想获取处理程序中的请求,但处理程序永远不会被调用。
我认为它可能是 IIS 7 配置返回 404 而不是将其传递给处理程序。
请提供任何可以将请求路由到 httphandler 的建议或配置,无论是否存在。
我在本地环境中使用带有 IIS 7 集成模式的 asp.net MVC 2 和目标框架 4.0,因此上述两个 URL 都不会为任何主体打开。
我的处理程序是简单的 IHttpHandler ,具有以下 IIS 配置
<add name="CrossDomainResourceHandler" type="MvcApplication3.HttpHandlers.CrossDomainResourceHandler" path="*.jpg" verb="*" resourceType="Unspecified" allowPathInfo="false" modules="IsapiModule" scriptProcessor="%path%\aspnet_isapi.dll"/>
I have httpHandler that handles the jpg file. When a request for a jpg image comes to server it is forwareded to handler. This works fine until i implemented finger printing for google page speed rule.
Now it gets called for http://static2.localnatamam.com/Uploaded/Image/Image_Haroon_ur_Rasheed_78.jpg
but not for
First file exist in directory but second does not exist as the second URL is finger printed and i want to get the request in Handler but handler never gets evoked.
I think its might be IIS 7 configuration that is returning 404 rather than passing it to handler.
Please any advise or configuration that can route request to httphandler no matter if exist or not.
I am using asp.net MVC 2 with IIS 7 integreated Mode with target framework 4.0 in local enviornment so both of above URL will not open for any body.
My handler is simple IHttpHandler with the following IIS configuration
<add name="CrossDomainResourceHandler" type="MvcApplication3.HttpHandlers.CrossDomainResourceHandler" path="*.jpg" verb="*" resourceType="Unspecified" allowPathInfo="false" modules="IsapiModule" scriptProcessor="%path%\aspnet_isapi.dll"/>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
确保您的 web.config 文件中包含此内容:
runAllManagedModulesForAllRequests 将告诉 IIS 通过 .net 管道路由每个请求,以便您的模块能够接收此请求,因为默认情况下,.jpg 等静态资源被配置为不通过 asp 运行。网。
Make sure you have this in your web.config file:
runAllManagedModulesForAllRequests will tell IIS to route every request through the .net pipeline so that your module will pick this request up since by default static resources like .jpg are configured to not run through asp.net.