1
votes

I have my SignalR Host in a simple Windows Service application.

protected override void OnStart(string[] args)
{
    const string url = "https://localhost:8080";

    AppDomain.CurrentDomain.Load(typeof(MyHub).Assembly.FullName);

    using (WebApp.Start<Startup>(url))
    {
        Log(string.Format("Device Hub started on {0}", url));
    }
}

Where MyHub is the name of my Hub class in a referenced console project and Startup is just

public class Startup
{
    public void Configuration(IAppBuilder app)
    {
        app.MapSignalR();
        app.UseCors(CorsOptions.AllowAll);
    }
}

SignalR seems to start, but I keep getting a 404 Error on https://localhost:8080/signalr/hubs. I think it may not be recognizing the hub, but I can't quite figure out how to register it. Any suggestions?

** This exact code worked when running a console application, but seems to fail now that it is being accessed via a service **

3

3 Answers

1
votes

You might want to check something like this:

http://allen-conway-dotnet.blogspot.ch/2012/02/applying-and-using-ssl-certificate-with.html

It's not as simple as for http, or for https+IIS.

UPDATE

Ok, I read it more carefully and I think you have a major fault, you are calling your Start method inside a using(...) block, which means that you close your hosting immediately (the OnStart method exits). Remove your using(...) block and it should work (I tested it with http).

Also, the AppDomain stuff is not needed at all, given the fact that MyHub is referenced in your project.

0
votes

How about the configuration: link And just out of curiosity: does the hub work with HTTP only? (without SSL?)

EDIT: Change the url from https://localhost:8080 to https://127.0.0.1:8080 and try again.

0
votes

change the port on your connection string to 443 like this

const string url = "https://localhost:443";

or not using ssl

 const string url = "http://localhost:8080";