14

I am using Azure SignalR with Asp.Net MVC API (with .net framework not .net core) project. I can never connect to Azure's SignalR service (tried any possible configuration) while everything works fine when signalr is self-hosted.

As I enable CLR exceptions (under Exception Settings pane by checking everything under Common Language Runtime Exceptions) I keep getting the two following errors:

1. System.Net.WebException: 'The remote server returned an error: (429) Too Many Requests.'

2. System.Net.WebSockets.WebSocketException: 'Unable to connect to the remote server'. Inner Exception WebException: The remote server returned an error: (429) Too Many Requests.

I am using SignalR Free tier but also tried with Standard tier and ended up with the same results.

I keep checking "Connection (max)" graph under "Overview" tab on Azure portal and observing "Server 20, client 0" all the time.

The first time I got the error I assumed I really tried connecting too many times and reached maximum connection/attempt and gave up trying. After some time (approximately 24 hours) I only tried three times and still getting the same exception (429 - too many requests).

This is my configuration (in Startup.cs):

app.MapAzureSignalR(
                "/signalr",
                GetType().FullName,
                new HubConfiguration
                {
                    // tried all combinations of boolean values below.
                    EnableDetailedErrors = true,
                    EnableJSONP = true,
                    EnableJavaScriptProxies = true
                }, options =>
                {
                    options.ConnectionCount = 5; // tried increasing and decreasing that number.
                    options.ConnectionString = "<my connection string from azure portal signalr service>";
                    options.AccessTokenLifetime = TimeSpan.FromDays(1); // tried even removing.
                }
            );

This code runs on my local machine, not on Azure's AppService. However, it won't run on AppService either. Because it is easier to debug on local machine, I have been trying on local machine.

I searched on the internet but have not found anything related to my issue.

How do I solve the problem?

EDIT: I have the following packages installed.

<package id="Microsoft.AspNet.SignalR" version="2.4.1" targetFramework="net472" />
<package id="Microsoft.AspNet.SignalR.Core" version="2.4.1" targetFramework="net472" />
<package id="Microsoft.AspNet.SignalR.JS" version="2.4.1" targetFramework="net472" />
JustWork
  • 1,944
  • 3
  • 22
  • 34
  • Hi, will you be able to solve this issue? I have hanging Server connections, which are not closed, so 429 error appear. – Anna Nov 04 '19 at 03:52
  • No, sadly. I went with not using .net core for SignalR as I didn’t have more time spending on it. – JustWork Nov 04 '19 at 07:18
  • For future users, I'm sharing link [Troubleshooting guide for Azure SignalR Service common issues](https://learn.microsoft.com/en-us/azure/azure-signalr/signalr-howto-troubleshoot-guide#429-too-many-requests-returned-for-client-requests) – Vikram Singh Saini Oct 22 '21 at 09:58

1 Answers1

6

Edited:

How many hubs are defined in your server-side? The server connection count for AspNet SignalR is (hub count + 1) * options.ConnectionCount


For Free instances, there are 2 dimensions of limits:

  1. Concurrent connection count <= 20
  2. Total message count sent per day <= 20K (refreshed every day at 12:00am UTC time).

There is no message limit for Standard tiers.

Here is the pricing detail for Azure SignalR Service. Here explains in detail how messages and connections are calculated.

stuzor
  • 2,275
  • 1
  • 31
  • 45
vicancy
  • 323
  • 3
  • 11
  • 2
    Don’t do this. This has nothing to do with the question. – JustWork Mar 19 '20 at 14:02
  • @JustWork How many hubs you have? the server connection count for AspNet SignalR is `(hub count +1) * options.ConnectionCount ` – vicancy Mar 19 '20 at 14:05
  • I had published my code to an Azure service and had forgotten to stop it. Then when I was running it locally against a Free tier Azure SignalR Service, I encountered the `429 (Too Many Requests)` error. Then I realized I was running the free tier and each service you have connected is considered a `Unit` and the free tier only allows a single unit. – stuzor Feb 14 '23 at 00:04