locked
Connection Timeout RRS feed

  • Question

  • User-525411387 posted

    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

    Sunday, October 20, 2019 7:54 AM

Answers

  • User-525411387 posted

    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.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, October 21, 2019 9:53 AM

All replies

  • User61956409 posted

    Hi alisufian27,

    alisufian27

    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

    Monday, October 21, 2019 5:52 AM
  • User-525411387 posted

    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.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, October 21, 2019 9:53 AM