诊断 WebResource.axd 请求为何为空
我发现对于一个特定的 Web 应用程序,对 WebResource.axd 的请求返回一个完全空的页面。 (将链接复制并粘贴到新的浏览器窗口中会导致完全空的响应文档)
IIS 日志显示对 WebResource.axd 的请求成功(HTTP 状态代码 200)
应用程序本身很复杂,因此看起来很可能是应用程序正在执行的操作导致了此问题,但我不知道是什么。
我可以采取哪些额外的调试步骤来找出这些请求失败的原因,以及我应该在哪里查找应用程序特定行为可能以这种方式影响 WebResource.axd 的位置?
到目前为止我已经尝试过的事情:
- 在 IIS 中创建一个指向同一目录的新虚拟目录会产生相同的结果(空 WebResource.axd 文档)
- 创建一个全新的独立空白页面并将其放置在此目录中会产生相同的结果。
- 如果我在 IIS 中创建一个指向不同文件夹的新虚拟目录,则空白页面将按预期工作。
- 在工作/损坏目录之间交换 web.config 文件似乎没有影响。
这是在运行 IIS 5.1 的 Windows XP 计算机上
I'm finding that for one particular web application requests to WebResource.axd are returning a completely empty page. (Copying and pasting the link into a new browser window results in a completley empty response document)
IIS logs showing that the requests to WebResource.axd are successful (HTTP status code 200)
The application itself is complex and so it seems likely that it is something that the application is doing which is causing this, however I don't know what.
What additional debugging steps can I take to work out why these requests are failing, and where should I look for places where application specific behaviour might affect WebResource.axd in this way?
Things I have tried so far:
- Creating a new virtual directory in IIS pointing towards the same directory gives the same results (empty WebResource.axd document)
- Creating a completely new indepdent blank page and placing it in this directory gives the same results.
- If I create a new virtual directory in IIS pointing towards a different folder then the blank page works as expected.
- Swapping the web.config files between the working / broken directories appears to have no impact.
This is on a Windows XP machine running IIS 5.1
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
事实证明,问题出在我在 Global.asax 的
Application_PreRequestHandlerExecute
方法中应用的 HttpResponse 过滤器。我将过滤器一般应用于所有请求 - 即使过滤器使 WebResouce.axd 的内容保持不变,这仍然会导致问题。以下链接帮助我解决了这个问题,并更详细地描述了这一点:
解决方案是跳过对 WebResouce.axd 应用过滤器。
It turns out that the problem was a HttpResponse filter that I was applying in the
Application_PreRequestHandlerExecute
method in Global.asax. I was applying the filter generically to all requests - even though the filter left the content unchanged for WebResouce.axd, this still caused problems.The following links helped me out and describe this in more detail:
The solution was to skip applying the filter for WebResouce.axd.
如果您碰巧使用 Visual Studio 2013 Preview,这是一个已知问题:
https://connect .microsoft.com/VisualStudio/feedback/details/792689/webresource-axd-returns-a-200-ok-empty-response
(显然这不适用于OP,但适用于来自谷歌的任何人)
If you happen to be using Visual Studio 2013 Preview, this is a known issue:
https://connect.microsoft.com/VisualStudio/feedback/details/792689/webresource-axd-returns-a-200-ok-empty-response
(obviously this doesn't apply to OP, but to anyone coming from google)
我没有使用Application_PreRequestHandlerExecute,而是在Application_BeginRequest中添加OutputFilterStream。这导致 WebResource.axd 响应返回相同的问题,状态代码为 200,但响应为空。
I was not using Application_PreRequestHandlerExecute, but adding the OutputFilterStream in the Application_BeginRequest. This caused the same issue with the WebResource.axd response coming back with status code 200 but an empty response.