11

我正在使用 SignalR .NET 客户端库创建控制台应用程序/win 服务,以在 Web 上使用 HTTPS 连接到信号 R 集线器。其中一些客户端可能需要 Web 代理才能访问 Internet。在哪里/如何为 SignalR 客户端设置 Web 代理?

这到底怎么不是一个真正的问题?当客户端位于防火墙/TMG 代理服务器后面时,我无法让 signalR 连接到 Web 服务器集线器。

4

3 回答 3

5

为此使用Connection.Proxy属性 - https://msdn.microsoft.com/en-us/library/microsoft.aspnet.signalr.client.connection.proxy(v=vs.111).aspx

例子:

var hubConnection = new HubConnection(url);
var webProxy = new WebProxy(new Uri(“address”));
webProxy.Credentials = new NetworkCredential(“Username”, “Password”);
hubConnection.Proxy = webProxy;
于 2015-03-31T09:04:26.997 回答
3

尝试这个:

var webProxy = new WebProxy(new Uri(proxyUrl));

var connection = new HubConnectionBuilder().WithUrl("signalR hub endpoint", h => h.Proxy = webProxy).Build();         
于 2018-07-02T21:01:41.720 回答
0

In fact we implemented signalr to have a kind of real time progress about some document generation.

Some of our customers couldn't create documents any more because the connection disconnected.

"Maybe" because of some proxy server who not really blocked but hold the request for a while to scan it, so that signalr client got a timeout

于 2015-03-24T08:47:17.660 回答