简体   繁体   English

如果不能公开访问,是否可以将自托管控制台应用程序用作 Signal R 服务器?

[英]Is it possible to use a Self Hosted Console Application as a Signal R Server if it is not publicly accessible?

I want to run a self hosted C# console application that acts as a Signal R server that broadcasts to a ASP.NET MVC web application acting as a client at PokerConquest.com.我想运行一个自托管 C# 控制台应用程序,该应用程序充当 Signal R 服务器,该服务器广播到充当 PokerConquest.com 客户端的 ASP.NET MVC Web 应用程序。

Whilst the website is publicly accessible.. does the server console application need to be publicly accessible?虽然该网站是可公开访问的...服务器控制台应用程序是否需要可公开访问? The communication will be one way (server to client).通信将是一种方式(服务器到客户端)。 The self hosted console application can 'see' the outside world / make web requests etc.. it's just not publicly accessible.自托管控制台应用程序可以“看到”外部世界/发出网络请求等。它只是不可公开访问。

All the samples you see online use localhost like this..您在网上看到的所有示例都像这样使用 localhost。

The server..服务器..

string url = "http://127.0.0.1:8088";
var SignalR = WebApp.Start(url);

And the client..还有客户..

var connection = new HubConnection("http://127.0.0.1:8088/");
var myHub = connection.CreateHubProxy("MyHub");

which is great if your signal r servers and clients are on the same machine but a lot of the time they wont be..如果您的信号服务器和客户端在同一台机器上,这很好,但很多时候它们不会......

So is it possible for a non publicly accessible self hosted console app to act as a signal r server and broadcast to a publicly accessible web app client?那么,不可公开访问的自托管控制台应用程序是否有可能充当信号服务器并广播到可公开访问的 Web 应用程序客户端?

Signalr broadcasts are sent to clients that connect to the Signalr server (using Web Sockets or traditional AJAX). Signalr 广播发送到连接到 Signalr 服务器的客户端(使用 Web 套接字或传统 AJAX)。

If the clients cannot connect to the server, nothing will work.如果客户端无法连接到服务器,则没有任何效果。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM