在C#HTTP代理服务器 [英] HTTP Proxy server in C#

查看:461
本文介绍了在C#HTTP代理服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我公司与编写使用.NET 3.5 Fx的和C#中的代理服务器进行试验。从我们的研究我读过的HttpListener是不是代理一个很好的候选服务器虽然我不确定为什么。

My company is experimenting with writing a proxy server using the .NET Fx 3.5 and C#. From our research I have read that HttpListener is not a good candidate for a proxy server though I am unsure as to why.

我们目前正与的颏代理示例源代码虽然这将涉及,除其他事项外,执行我们自己的日志和性能计数器。使用的HttpListener将包裹则Http.sys这将给我们一些我们需要开箱即用的性能统计信息。

We are currently working with the Mentalis proxy example source code though that will involve, among other things, implementing our own logging and performance counters. Using HttpListener will wrap Http.sys which will give us some of the performance statistics we require out of the box.

那么,为什么是的HttpListener HTTP代理工作不好的候选人呢?

So why is HttpListener a bad candidate for HTTP proxy work?

(是的,我们可以通过写入或配置ICAP服务器以及考虑鱿鱼3.1)。

(And yes we are considering Squid 3.1 by writing or configuring an ICAP server as well.)

推荐答案

的HttpListener是在.NET中的的简单的HTTP服务器提供了一个重要的组成部分。在这里简单的包括不支持高运转率。

HttpListener is in .NET to provide a major building block for a simple HTTP server. Where simple includes not supporting high operation rates.

通常HTTP代理需要非常低的开销,以支持多个并发连接,以及提供代理的功能(这依赖于代理的类型)。

Typically HTTP proxies need to be very low overhead to support many concurrent connections as well as providing the proxy's function (which depends on the type of proxy).

代理服务器是的 RFC 2616§8.1.3),并立即提供一个项目了(如果我理解正确的HttpListener)是不可能的:

Proxies are detailed in RFC 2616 §8.1.3) and that immediately provides one item that (if I understand HttpListener correctly) is not possible:

代理服务器必须与客户和原始服务器(或其他代理服务器),它连接到单独信号持久连接。每个持久连接只适用于一个传输链路。

The proxy server MUST signal persistent connections separately with its clients and the origin servers (or other proxy servers) that it connects to. Each persistent connection applies to only one transport link.

这篇关于在C#HTTP代理服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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