如何调整nettcpbinding以使用袜子代理? [英] How can I tune the nettcpbinding to use a socks proxy?

查看:79
本文介绍了如何调整nettcpbinding以使用袜子代理?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将袜子代理与nettcpbinding一起使用,而不是直接连接.这是因为我的大多数公司客户都不允许直接的outbouond连接.

我尝试使用< system.net>< defaultProxy enabled ="true">. app.config文件中的部分",但似乎仅适用于http代理.

我已经找到了与System.ServiceModel.Channels.SocketConnectionInitiator.Connect()的有效套接字连接,但将其标记为内部的,因此我无法覆盖连接逻辑以添加代理处理代码.它由ConnectionPoolHelper(也是内部的)调用,并且由ClientFramingDuplexSessionChannel类(内部)调用.

我现在可以想到的唯一干净的方法是重写整个NetTcpBinding代码,但是由于我无法继承很多类,因此这是一个漫长而乏味的任务,而且似乎没有就像这是个好主意.

我可以做的另一件事是将一些代码直接注入SocketConnectionInitiator类,以便我执行自定义代理代码,而不是标准的代理代码,但同样,这看起来像是黑客,而当该框架的下一版本在那里时,可能会引起问题.

有没有我忽略的东西?另一种选择是使用另一种通信技术,如果我不能让wcf在袜子代理上工作,我一定会考虑的.


I need to use a socks proxy with my nettcpbinding instead of a direct connection. This is because most of my corporate clients don't allow direct outbouond connections.

I've tried using the <system.net><defaultProxy enabled="true"> section in the app.config file, but it seems it only works for http proxies.

I've traced down the effective socket connection to System.ServiceModel.Channels.SocketConnectionInitiator.Connect(), but it's marked as internal so I cannot override the connection logic to add the proxy handling code. It's called by the ConnectionPoolHelper (which is internal as well), and which is called by the ClientFramingDuplexSessionChannel class (internal).

The only clean way I can think off now is to rewrite the whole NetTcpBinding code, but since there are a lot of classes I can't inherit from, it's a long and tedious task, and doesn't seem like it's a good idea.

Something else I can do is to inject some code directly into the SocketConnectionInitiator class so that I execute my custom proxy code instead of the standard one, but again, this rather look like a hack, and may cause problems when the next version of the framework is there.

Is there something I overlooked? The alternative is using another communication technology, which I'll definitely consider if I can't get wcf to work over a socks proxy.


推荐答案

并非严格地回答您的祷告,但您可以构建一个桥接服务器,该服务器公开仅在DMZ中充当外部服务的服务,或安装像e-这样的深层堆栈代理客户端对应用程序层透明的边框.银行和其他公司通常会使用其极为严格的安全机制来处理众多专有交易应用程序,提供类似e Border的解决方案.

Not strictly an answer to your prayers but you could build a bridge server which exposes a service that simply acts as a go-between to the outside world in the DMZ or install a deep stack proxy client like e-Borders which would be transparent to the application layer. Banks and other corps often have an e Border like solution for their miriad of proprietary trading apps working with their ultra strict security regimes.


这篇关于如何调整nettcpbinding以使用袜子代理?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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