locked
SignalR hub is undefined after deployment (works through VS2015) RRS feed

  • Question

  • User-206725469 posted

    Hi,

    Lots of frustration with SignalR, in the last step before deploying I ran into this problem. I tried all the answers I found online but without success.

    How can I find the cause of the problem?

    Thanks

    Saturday, July 11, 2020 5:55 AM

Answers

  • User-206725469 posted

    Hi,

    This solved my problem!

            <script src=@Url.Content("~/Scripts/jquery.signalR-2.4.1.js")></script>
            <script src=@Url.Content("~/signalr/hubs")></script>

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, July 12, 2020 6:40 AM

All replies

  • User475983607 posted

    We are not mind readers here on the forum.   We do not know what you've tried or the actual error message. 

    Should we assume undefined is a a JavaScript error?  That would lead me to believe the deployment is missing JavaScript files or the file references are incorrect. 

    Open the browser's dev tools and look for 404 errors.

    Saturday, July 11, 2020 10:06 AM
  • User-206725469 posted

    Hi,

    My question is about settings that need to be made in order to publish Signalr project.
    The fact is that when I run in a VS environment everything is fine but when I publish to the server I get $.connection undefined.
    I attached Javascript code, BundleConfig.cs and Index.cshtml.

                        $(function () {
                            var ticker = $.connection.OnlineScreenTicker;
                            
                            $.connection.hub.start().done(function () {
                                ticker.server.getAll().done(function (OnlineRecords) {
                                    var dataLicences = OnlineRecords.transactions;
                                    vm.onlineSettingsGrid.setDataSource(dataLicences);
                                });
                            });
                        });
                bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                "~/Scripts/jquery.signalR-2.4.1.min.js"));
    
                bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                            "~/signalr/hubs"));
            <script src="~/Scripts/jquery.signalR-2.4.1.min.js"></script>
            <script src="~/signalr/hubs" type="text/javascript"></script>






    Saturday, July 11, 2020 6:55 PM
  • User-206725469 posted

    Hi,

    This solved my problem!

            <script src=@Url.Content("~/Scripts/jquery.signalR-2.4.1.js")></script>
            <script src=@Url.Content("~/signalr/hubs")></script>

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, July 12, 2020 6:40 AM