0
votes

I have a SignalR Windows Service client that was calling a method on the MVC app SignalR hub that was working when it all was localhost. When I deploy the MVC app to a real server, I get 404 rrors and I am not sure what to do or how to solve.

The client:

protected override async void OnStart(string[] args)
        {
            eventLog1.WriteEntry("In OnStart");
            try
            {
                var hubConnection = new HubConnection("http://somesplace.com/AlphaFrontendServer/signalr", useDefaultUrl: false);
                IHubProxy alphaProxy = hubConnection.CreateHubProxy("AlphaHub");

                await hubConnection.Start();

                await alphaProxy.Invoke("Hello", "Message from Service");
            }
            catch (Exception ex)
            {
                eventLog1.WriteEntry(ex.Message);
            }
        }

The Server code is:

public class AlphaHub : Hub
    {
        public void Hello(string message)
        {
            // We got the string from the Windows Service 
            // using SignalR. Now need to send to the clients
            Clients.All.addNewMessageToPage(message);

            // Send message to Windows Service

        }

and

public partial class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            ConfigureAuth(app);
            app.MapSignalR("/signalr", new HubConfiguration());
        }
    }

The Hello method was being called when everything was localhost. Now it generates a 404 error:

StatusCode: 404, ReasonPhrase: 'Not Found', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
{
  Connection: close
  Cache-Control: private
  Date: Tue, 11 Feb 2014 17:09:41 GMT
  Server: Microsoft-IIS/8.5
  X-AspNet-Version: 4.0.30319
  X-Powered-By: ASP.NET
  Content-Length: 3510
  Content-Type: text/html; charset=utf-8
}
1
Could be a security error. What Account is your Windows service running under? - rwisch45
An account called Admin that has full Admin privs. Do I need to enable Cors? How in my Startup? - user2471435
Acually I am getting a 404. StatusCode: 404, ReasonPhrase: 'Not Found', Version: 1.1, Content: System.Net.Http.StreamContent, Headers: { Connection: close Cache-Control: private Date: Tue, 11 Feb 2014 17:09:41 GMT Server: Microsoft-IIS/8.5 X-AspNet-Version: 4.0.30319 X-Powered-By: ASP.NET Content-Length: 3510 Content-Type: text/html; charset=utf-8 } - user2471435
Can you tell us which request(s) get a 404 response? - halter73

1 Answers

0
votes

You should try out the suggestions from the "404 Not Found" error section of this SignalR troubleshooting guide.

Some of the possible causes for the 404 include:

  • Invalid address
  • Interference from other routes added before the call to MapSignalR
  • Using IIS 7 or 7.5 without the update for extensionless URLs
  • Corrupt/out-of-date IIS cache