简体   繁体   中英

SignalR will not establish connection with IIS Express on Windows 8 using VS2013 from Chrome or IE

I am just starting out with SignalR so forgive me if I've overlooked something super basic. My goal is to have a "holding page" for a user to sit on until a particular event has happened server side that tells that page to take the user to the next step in the process. I've created a Hub on the server that seems to work properly when the client is invoking calls on the server.

The problem is the client never receives any calls from the server and from the browser console output it appears the client never establishes the necessary connection to the hub.

I've tried this in latest Google Chrome and MS IE v11. I get the same messages logged in each browser.

Below is the browser console output from MS IE (I couldn't find an easy way to save the Chrome console output to text):

[10:32:02 GMT-0400 (Eastern Daylight Time)] SignalR: Client subscribed to hub 'signinghub'.
[10:32:02 GMT-0400 (Eastern Daylight Time)] SignalR: Negotiating with '/signalr/negotiate?clientProtocol=1.4&connectionData=%5B%7B%22name%22%3A%22signinghub%22%7D%5D'.
[10:32:02 GMT-0400 (Eastern Daylight Time)] SignalR: Connecting to websocket endpoint 'ws://localhost:53915/signalr/connect?transport=webSockets&clientProtocol=1.4&connectionToken=orv901EJmuVZdJis9VFLBMVTl8bgZlbK5pWdAxiugZiYOCPPxytCCjewTQ%2FxcM0bMcGxDdRY6T46ApZSWnL%2BRO8kkllhVhYr1ZROWGSdyFQ2580j%2BR6lXitPVhdXncon&connectionData=%5B%7B%22name%22%3A%22signinghub%22%7D%5D&tid=8'.
[10:32:02 GMT-0400 (Eastern Daylight Time)] SignalR: Websocket opened.
[10:32:07 GMT-0400 (Eastern Daylight Time)] SignalR: webSockets timed out when trying to connect.
[10:32:07 GMT-0400 (Eastern Daylight Time)] SignalR: Closing the Websocket.
[10:32:07 GMT-0400 (Eastern Daylight Time)] SignalR: This browser doesn't support SSE.
[10:32:07 GMT-0400 (Eastern Daylight Time)] SignalR: Binding to iframe's load event.
[10:32:12 GMT-0400 (Eastern Daylight Time)] SignalR: foreverFrame timed out when trying to connect.
[10:32:12 GMT-0400 (Eastern Daylight Time)] SignalR: Stopping forever frame.
[10:32:12 GMT-0400 (Eastern Daylight Time)] SignalR: Opening long polling request to 'http://localhost:53915/signalr/connect?transport=longPolling&clientProtocol=1.4&connectionToken=orv901EJmuVZdJis9VFLBMVTl8bgZlbK5pWdAxiugZiYOCPPxytCCjewTQ%2FxcM0bMcGxDdRY6T46ApZSWnL%2BRO8kkllhVhYr1ZROWGSdyFQ2580j%2BR6lXitPVhdXncon&connectionData=%5B%7B%22name%22%3A%22signinghub%22%7D%5D&tid=4'.
[10:32:13 GMT-0400 (Eastern Daylight Time)] SignalR: Long poll complete.
[10:32:13 GMT-0400 (Eastern Daylight Time)] SignalR: Opening long polling request to 'http://localhost:53915/signalr/poll?transport=longPolling&messageId=d-65C891D3-Q%2C0%7CU%2C0%7CV%2C3%7CW%2C0&clientProtocol=1.4&connectionToken=orv901EJmuVZdJis9VFLBMVTl8bgZlbK5pWdAxiugZiYOCPPxytCCjewTQ%2FxcM0bMcGxDdRY6T46ApZSWnL%2BRO8kkllhVhYr1ZROWGSdyFQ2580j%2BR6lXitPVhdXncon&connectionData=%5B%7B%22name%22%3A%22signinghub%22%7D%5D&tid=10'.
[10:32:17 GMT-0400 (Eastern Daylight Time)] SignalR: longPolling timed out when trying to connect.
[10:32:17 GMT-0400 (Eastern Daylight Time)] SignalR: Aborted xhr request.
[10:32:17 GMT-0400 (Eastern Daylight Time)] SignalR: Stopping connection.
[10:32:17 GMT-0400 (Eastern Daylight Time)] SignalR: Fired ajax abort async = true.

I've read through the Introduction to SignalR and know that it will attempt to fail over from the most preferred communication technology to the least preferred. From what I can tell it is trying all 4 methods to communicate and failing on every one and eventually giving up with a "Stopping connection." message.

I'm using VS 2013 and IIS Express for development, SignalR v2.1.0, and ASP.NET MVC 5.

UPDATED TO INCLUDE CLIENT CODE

Below is the script in the client used to connect to the hub:

<!--Reference the SignalR library. -->
<script src="~/Scripts/jquery.signalR-2.1.0.min.js" type="text/javascript"></script>
<!--Reference the autogenerated SignalR hub script. -->
<script src="~/signalr/hubs"></script>

<script>
    $.connection.hub.logging = true;

    $(function () {
        // Reference the auto-generated proxy for the hub.
        var chat = $.connection.signingHub;

        // Create a function that the hub can call back to redirect the user
        chat.client.signDocument = function () {
            // Add the message to the page.
            window.location.assign("/Signing/Initiate/" + ContractID.value + "?clientUserId=" + ClientUserId.value);
        };

        // Start the connection.
        $.connection.hub.start();
    });
</script>

MORE INFO...

I've discovered that this may be caused by a 3rd party component suite that I am using from DevExpress. I am able to follow the chat sample here and SignalR is working great. As soon as I add an MVC extension control from DevExpress the SignalR connection negotiation breaks down. I've commented on a question in their support forum here to hopefully get an answer.

Thanks for any help you can provide!

After getting some feedback from the DevExpress support team it seems the problem is with the latest release of SignalR 2.1.0. I downgraded my project to v2.0.3 and it began working fine. You can see my conversation with the DevExpress support team here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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