I have deployed a signalr hub which is a console application on Virtual machine the code is
[assembly: OwinStartup(typeof(VMHost.Startup))]
namespace VMHost
{
class Program
{
static void Main(string[] args)
{
string url = @"http://localhost:8090/";
using (WebApp.Start<Startup>(url))
{
Console.WriteLine(string.Format("Server running at {0}", url));
Console.ReadLine();
}
}
}
and a javascript client the code is
@section scripts{
<script src="~/Scripts/jquery.signalR-2.4.1.js"></script>
<script src="http://51.144.51.110:8090/signalr/hubs"></script>
<script type="text/javascript">
$(function () {
$.connection.hub.url = "http://51.144.51.110:8090/signalr";
var chat = $.connection.testHub;
$.connection.hub.start()
.done(function () {
chat.server.getAllSettings();
})
.fail(function () {
});
chat.client.broadcastData = function (data) {
$("#dataTable").empty();
for (var i = 0; i < data.length; i++) {
//append html
}
}
});
}
now when I run this it gives me an error in browser console said
Failed to load resource: net::ERR_CONNECTION_TIMED_OUT
Uncaught Error: SignalR: Error loading hubs. Ensure your hubs reference is correct, e.g. <script src='/signalr/js'></script>.
please help me to solve this
on my local system, it works perfect and returns data from the hub but when I deploy to Virtual machine it is giving me this error
Uncaught Error: SignalR: Error loading hubs. Ensure your hubs reference is correct, e.g. <script src='/signalr/js'></script>.
Please check if the SignalR hub script ('signalr/hubs') is generated and loaded as expected using browser F12 developer tool Network.
With Regards,
Fei Han
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
The issue was hub is not connected with my client you can the issue was is url so i just replace the "http://localhost:8090/" to "http://+:8090/" and it works perfectly.
Member
2 Points
21 Posts
Connection Timeout
Oct 20, 2019 07:54 AM|alisufian27|LINK
I have deployed a signalr hub which is a console application on Virtual machine the code is
and a javascript client the code is
now when I run this it gives me an error in browser console said
please help me to solve this
on my local system, it works perfect and returns data from the hub but when I deploy to Virtual machine it is giving me this error
All-Star
40565 Points
6233 Posts
Microsoft
Re: Connection Timeout
Oct 21, 2019 05:52 AM|Fei Han - MSFT|LINK
Hi alisufian27,
Please check if the SignalR hub script ('signalr/hubs') is generated and loaded as expected using browser F12 developer tool Network.
With Regards,
Fei Han
Member
2 Points
21 Posts
Re: Connection Timeout
Oct 21, 2019 09:53 AM|alisufian27|LINK
The issue was hub is not connected with my client you can the issue was is url so i just replace the "http://localhost:8090/" to "http://+:8090/" and it works perfectly.