当处理其关联的 HttpModule 时,不处理 HttpHandler
在我们的 asp.net 2.0 应用程序中,我们有 HttpModule 和 HttpHandler。 它们在 web.config 中注册以处理某些文件类型的请求。 该请求是使用 MS AJAX 从客户端异步发起的。 我注意到一些奇怪的事情: HttpHandler:ProcessRequest 并未在每个 HttpModule:EndRequest 上输入,因为我对事件流程的理解,这似乎是不正确的行为: HttpModule:开始请求> HttpHandler:ProcessRequest> HttpModule:结束请求。 由于某种原因,处理程序部分有时会被跳过。 可能是什么原因造成的?
In our asp.net 2.0 application we have the an HttpModule and HttpHandler. They are registered in web.config to handle requests for certain file types.
The request is initiated asynchronously from client side using MS AJAX.
I noticed something strange:
HttpHandler:ProcessRequest is not entered on every HttpModule:EndRequest which seems like incorrect behavior since my understanding of the flow of events:
HttpModule:BeginRequest > HttpHandler:ProcessRequest > HttpModule:EndRequest. For some reason, the handler part is sometimes skipped.
What could be causing this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果我理解正确的话,HttpModule 将会针对到达应用程序的每个请求执行,而 HttpHandler 只会针对注册的扩展执行。
因此,除了您向处理程序发出的请求之外,可能还会向应用程序发送其他请求。
If I understand correctly, HttpModule would get executed for every request which comes to your application, while the HttpHandler would execute only for the registered extension.
So, there could be other request to the app apart from the ones you make to your handler.
您是否在 IIS 中设置了由 .net 处理的文件类型?
Do you have that file type set up in IIS to be processed by .net?
我相信对 Server.Transfer 和 Response.End 的调用可以使管道短路,您的逻辑分支是否可能这样做?
I believe that calls to Server.Transfer and Response.End can short-circuit the pipeline, is it possible a branch of your logic does this?