托管 ISAPI 筛选器 IIS 7.5
有没有办法在 IIS 7.5 的托管代码 (C#) 中编写 ISAPI 筛选器功能? 具体来说,我需要访问请求响应流,然后才能将其实际发送回客户端以实现某些缓存功能。 通过 HttpModule 或 HttpHandler 我只找到像 BeginRequest 或 ProcessRequest 这样的方法...
Is there any way to write ISAPI Filter functionality in Managed Code (C#) for IIS 7.5?
In detail, I need access to the Requests Response Stream, before it is actually sent back to the client to implement some caching functionality.
Via HttpModule or HttpHandler I only find methods like BeginRequest or ProcessRequest...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要一个 send_raw_data 过滤器,只是警告您,这些过滤器会带来严重的性能损失。它可能足以抵消缓存的好处,因此您应该记住这一点。
除了通过某种 C++ 包装器调用之外,我不知道如何使用托管代码执行此操作,但这是一个对性能非常敏感的代码路径,因此我不推荐它。 ISAPI 是为 C/C++ 设计的,您应该这样使用它。
You'd need a send_raw_data filter, and just to warn you, those carry a significant performance penalty. It may be enough to offset the benefit of caching, so you should keep that in mind.
I don't know of a way to do this with managed code, other than maybe calling it through some sort of C++ wrapper, but this is a very perf-sensitive code path, so I wouldn't recommend it. ISAPI is designed for C/C++ and you should use it that way.