SignalR client server connected but not pushing data to client on production server
Asked Answered
E

1

7

I have developed a web app using SignalR and its working perfectly on my development server. But for some unknown reasons its not working on production server.

I have done some tests:

$.connection.hub.start().done(function () {

        console.log('started');

});

This always gives my 'started' in console as expected. So client and server are connected. But when I send any data like login credentials, i am not receiving anything back.

Here is the connection frames image. As you can see client is sending data to server but not receiving anything in response.

enter image description here

public override Task OnConnected()
{

        Clients.All.Listen("Connected to HUB");

}

CLIENT SIDE Listen method:

hub.client.listen = function (response) {

    console.log('Listen', response);

}

There is a Listen method which I use to debug. This doesn't print anything. So signalr client server are not connecting.

EDIT:

Reported issue here: https://github.com/SignalR/SignalR/issues/4279 if this helps.

EDIT2:

My webapp is a Vue js 2 app. I compiled using vue-cli and uploaded to server. My signalr.js file is copied from an ASP.NET MVC project.

I made a Test ASP.NET MVC 5 app with SignalR 2.4 and I was able to communicate on live server.

Embryotomy answered 19/11, 2018 at 6:19 Comment(10)
Can you share minimal visual studio solution to reproduce the issue? IT is working fine for me with SignalR 2.0Regatta
Please mention your production server, is it IIS or Azure App Service or Azure SignalR Services?Brok
@AzazulHaq noneEmbryotomy
Then what should I assume about the server mentioned in question. "its not working on production server"Brok
@AzazulHaq oh sorry, Its IIS server.Embryotomy
Please mention IIS server version. Also I'm the login endpoint is working fine on your development environment.Brok
@AzazulHaq no nothing is working. No event is being fired from server side. For example in onConnect I have Clients.All.Listen("Connected to HUB"); but this method doesn't get fired and I don't see any output in console. Whereas this works ok on my local serverEmbryotomy
Can you please write the code of how you handle listen method on client side?Brok
Updated my question, I have mentioned that my app (client) is Vue 2 app compiled using vue-cli 3Embryotomy
2 things to consider: Is there a chance your minification is renaming the listen callback in your production server? Does your production server have WebSockets enabled?Dysphemia
R
0

https://learn.microsoft.com/en-us/aspnet/signalr/overview/testing-and-debugging/troubleshooting

IIS issues

This section contains issues with Internet Information Services.

SignalR works on Visual Studio development server, but not in IIS

SignalR is supported on IIS 7.0 and 7.5, but support for extensionless URLs must be added. To add support for extensionless URLs, see https://support.microsoft.com/kb/980368

SignalR requires ASP.NET to be installed on the server (ASP.NET is not installed on IIS by default). To install ASP.NET, see ASP.NET Downloads.

Ronni answered 23/12, 2018 at 4:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.