Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HubConnection.Error handler is not called on connection error #4689

Open
igolets opened this issue Sep 26, 2023 · 0 comments
Open

HubConnection.Error handler is not called on connection error #4689

igolets opened this issue Sep 26, 2023 · 0 comments

Comments

@igolets
Copy link

igolets commented Sep 26, 2023

I'm using package id="Microsoft.AspNet.SignalR.Client" version="2.4.3" targetFramework="net48". Using Azure SignalR service with backend deployed as Azure WebApp.

Steps to reproduce

  1. App connects to server, reach "Connected" state
  2. Client subscribed to Closed, StateChanged, Error events. Error event handler suppress all exceptions.
  3. Shut down WebApp.
  4. Run Connection.Start() from Closed event handler

Expected behavior

  1. StateChanged (Connected -> Reconnecting)
  2. Error ("Unable to connect to remote server")
  3. Error ("Couldn't reconnect within the configured timeout of 00:00:05, disconnecting.")
  4. StateChanged (Reconnecting -> Disconnected)
  5. Closed()
  6. Restart by calling connection.Start()
  7. Repeat until connection is back.

Actual behavior

  1. StateChanged (Connected -> Reconnecting)
  2. Error ("Unable to connect to remote server")
  3. Error ("Couldn't reconnect within the configured timeout of 00:00:05, disconnecting.")
  4. StateChanged (Reconnecting -> Disconnected)
  5. Closed()
  6. Restart by calling connection.Start()
  7. After repeating this several times I get unhandled exception.

Exception type:
Microsoft.AspNet.SignalR.Client.HttpClientException

Source:
Microsoft.AspNet.SignalR.Client

Exception message:
StatusCode: 403, ReasonPhrase: 'Site Disabled', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
{
Connection: close
Date: Tue, 26 Sep 2023 15:06:55 GMT
Content-Length: 2342
Content-Type: text/html
}

Stack trace:
at Microsoft.AspNet.SignalR.Client.Http.DefaultHttpClient.<>c__DisplayClass5_0.b__1(HttpResponseMessage responseMessage)
at Microsoft.AspNet.SignalR.TaskAsyncHelper.<>c__DisplayClass31_02.<Then>b__0(Task1 t)
at Microsoft.AspNet.SignalR.TaskAsyncHelper.TaskRunners2.<>c__DisplayClass3_0.<RunTask>b__0(Task1 t)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant