1

I need to realize a simple cluster of workers that creates file zip file with a lot of pdf in it. The architecture, right now look like this:

  1. A single client (WebAPI + AngularJS)
  2. A cluster of Hangfire server that do the work

As soon the clients ask for a new zip file, the request is enqueued in the Hangfire queue. When one of the node in the cluster is free, the job will starts. During the execution of the job the client will be notified about the progress. Since the cluster, is necessary another component:

  1. A so called, SignalR backplane that handle the communication between workers and client

I use Redis to implement this component, and thanks to some NuGet packages (i.e. Microsoft.AspNet.SignalR, Microsoft.AspNet.SignalR.Redis) and this doc this is super simple and the only things I need is to add some new line in the Owin startups file; one for the worker:

public class WorkerStartup
{
    public void Configuration(IAppBuilder app)
    {
       GlobalConfiguration.Configuration.UseSqlServerStorage("HangFireDB");
       GlobalHost.DependencyResolver.UseRedis("IP", 6379, String.Empty, "TOPIC");

       app.MapSignalR();
       app.UseHangfireServer();
    }
}

one for the WebAPI, they are equals but Hangfire configuration:

public class ClientStartup
{
    public void Configuration(IAppBuilder app)
    {
       GlobalConfiguration.Configuration.UseSqlServerStorage("HangFireDB");
       GlobalHost.DependencyResolver.UseRedis("IP", 6379, String.Empty, "TOPIC");

       app.MapSignalR();
       app.UseHangfireDashboard(); // The client only needs Hangfire dashboard
    }
}

It works like a charm and Redis do the job pretty well. I would try to reimplement everything using Azure Service Bus (based on the link here), I replaced the package Microsoft.AspNet.SignalR.Redis with Microsoft.AspNet.SignalR.ServiceBus and replaced the line UseRedis like:

GlobalHost.DependencyResolver.UseServiceBus("Endpoint=sb://XXX.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=XXX", "TOPIC");

but as soon I start the client/server communication I get:

No transport could be initialized successfully. Try specifying a different transport or none at all for auto initialization."

What's wrong, it should work without problem...

BAD_SEED
  • 4,840
  • 11
  • 53
  • 110

1 Answers1

1

No transport could be initialized successfully. Try specifying a different transport or none at all for auto initialization.

To troubleshoot the issue, you could enable tracing and log on your hub, and you could see which transport your application is using in your browser console tab.

$.connection.hub.logging = true;

And then you could try to explicitly specify a different transport when the client connection is started and test if it works.

$.connection.hub.start({ transport: 'specify transport that you want' })

Currently, the following transports are supported:

  • WebSockets
  • Server-Sent
  • Events Forever Frame (for Internet Explorer only)
  • Ajax long polling
Fei Han
  • 26,415
  • 1
  • 30
  • 41
  • 1
    There was a problem with azure subscription, it seems that a Standard plan is needed (since topics are necessary) while I was on a basic plan. The problem right now is about versioning `Error: You are using a version of the client that isn't compatible with the server. Client version 1.5, server version undefined.` while both on client and server I have version 2.2.1. I don't know why? I suppose some problem with SignalR.ServiceBus package – BAD_SEED Mar 31 '17 at 12:17
  • Please try to use Microsoft ASP.NET SignalR 2.1.1, and test if it works. – Fei Han Apr 05 '17 at 09:05