SignalR Azure Cloud Service with Service Bus

2019-07-18 06:26发布

问题:

I have built a simple Chat application using SignalR followed the tutorial there, which works great.

Then I followed the tutorial of SignalR Scaleout with Azure Service Bus, also from Microsoft.

So I have completed all the following steps:

  • Created a new Cloud Service on Azure Portal
  • Created a new Service Bus namespace on Azure Portal
  • Created a Windows Azure Cloud Service with a SignalR ASP.NET Web Role
  • Setup the SignalR Web Role running on 2 instances (VM Size: Small)
  • Deployed the Cloud Service to the Azure Cloud Service.

But I can't get the SignalR Chat application to work. Can't start the hub.

I noticed it tried to use longPolling and shows status Cancelled/Abort in the browser's debugging tool (Chrome) with the following error in the console:

WebSocket connection to 'ws://example.cloudapp.net/signalr/connect?transport=webSockets&clientProtocol=1.5&connectionToken=KOlz9psd6yCqvYjmCbI3ch5mrXcP%2BAAl3JVMFaP24p2Cv%2FyRb94D5uE27SO9Bz%2B5Itba4vADtv3%2Btv2FMF9LJI6Zxr026UJYxDPNQMVpFTw2hiHd&connectionData=%5B%7B%22name%22%3A%22schathub%22%7D%5D&tid=10' failed: Error during WebSocket handshake: Unexpected response code: 400

and this is the log in the Network:

Do I need to do anything extra besides all the steps listed in the tutorial to make this work?

回答1:

Based on the current Pricing, you need to set the Service bus to at least Standard tier to support Topics.

In this case, I did create my service bus choosing Standard tier, although it shows Standard on it's Overview page under the "Pricing tier" section, I have to specifically go to the settings and scaled it up from Basic to Standard. Which has solved the problem.