title: SignalR Core, not getting response from server when client is connected
body: <p>I am working on a SignalR Clinet-Server connection. My server is <code>WebApi Core 2.1</code> and my client is <code>WPF .NET Framework 4.7.2</code>.</p>
  
  <p>On the client side I have a <code>singleton</code> hub service with one Instance to recive messages from server:</p>
  
  <pre><code>using System.Collections.ObjectModel;
  using Microsoft.AspNetCore.SignalR.Client;
  
  public class HubService
  {
      //singleton
      public static HubService Instance { get; } = new HubService();
  
      public ObservableCollection&lt;string&gt; Notifications { get; set; }
  
      public async void Initialize()
      {
          this.Notifications = new ObservableCollection&lt;string&gt;();
  
          var hubConnection = new HubConnectionBuilder()
              .WithUrl(UrlBuilder.BuildEndpoint("Notifications"))
              .Build();
  
          hubConnection.On&lt;string&gt;("ReciveServerUpdate", update =&gt;
          {
              //todo
          });
  
          await hubConnection.StartAsync();
      }
  }
  </code></pre>
  
  <p>i initialize it as singleton:</p>
  
  <pre><code>    public MainWindowViewModel()
      {
          HubService.Instance.Initialize();
      }
  </code></pre>
  
  <p>While I'm debugging, on <code>MainWindowViewModel</code> im hitting that <code>HubService</code>.</p>
  
  <p>On <code>Server</code> side its look like this.</p>
  
  <p><code>Hub</code>:</p>
  
  <pre><code>using System.Threading.Tasks;
  using Microsoft.AspNetCore.SignalR;
  
  public class NotificationsHub : Hub
  {
      public async Task GetUpdateForServer(string call)
      {
          await this.Clients.Caller.SendAsync("ReciveServerUpdate", call);
      }
  }
  </code></pre>
  
  <p>Im trigering send message in this way in my controller's methods:</p>
  
  <pre><code>    [HttpPost]
      public async Task&lt;IActionResult&gt; PostTask([FromBody] Task task)
      {
          if (!this.ModelState.IsValid)
          {
              return this.BadRequest(this.ModelState);
          }
  
          this.taskService.Add(task);
  
          //here im calling sending message. When im debugging
          //i see one connection from my WPF with unique ConnectionId
          await this.notificationsHub.Clients.All.SendAsync("ReciveServerUpdate", "New Task in database!");
  
          return this.Ok(task);
      }
  </code></pre>
  
  <p>As I wrote before, while I'm debugging my <code>WebApi</code>, in <code>Clients</code> I have exactly one connection from my <code>WPF</code>. When I turn off <code>WPF</code>, <code>connection count = 0</code> so connections works perfectly. </p>
  
  <p>But when I call <code>SendAsync()</code>, I'm not reciving any information in <code>WPF</code> in <code>hubConnection.On</code>. Funny thing, yesterday it works perfectly.</p>
  
  <p>So, is my thinking about making <code>HubService</code> as static <code>singleton</code> is right? If its, why i cant recive messages from <code>WebApi</code> by <code>SignalR</code> when my <code>WPF</code> is connected to it?</p>
  
  <p>I asked something similiar yesterday but i found a solution for it. Yesterday, my methods works, i could hit <code>hubConnection.On</code> when i get any message from <code>WebApi</code>. <a href="https://stackoverflow.com/questions/56346533/signalr-core-statuscode-404-reasonphrase-not-found-version-1-1">My question from yestarday</a>. </p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Injection of <code>HUb</code> to controller:</p>
  
  <pre><code>    private readonly ITaskService taskService;
  
      private readonly IHubContext&lt;NotificationsHub&gt; notificationsHub;
  
      public TaskController(ITaskService taskService, IHubContext&lt;NotificationsHub&gt; notificationsHub)
      {
          this.taskService = taskService;
          this.notificationsHub = notificationsHub;
      }
  </code></pre>
  
  <p>And <code>Startup.cs</code> only <code>SignalR</code> things (i deleted other things not related to signal):</p>
  
  <pre><code>    public void ConfigureServices(IServiceCollection services)
      {
          services.AddHttpContextAccessor();
          services.AddSignalR();
      }
  
      public void Configure(IApplicationBuilder app, IHostingEnvironment env)
      {
          app.UseSignalR(routes =&gt; routes.MapHub&lt;NotificationsHub&gt;("/Notifications"));
      }
  </code></pre>
  
  <p><strong>EDIT2</strong></p>
  
  <p>Here is connection that i can get it, when my client <code>WPF</code> will register his connection:</p>
  
  <p><a href="https://i.stack.imgur.com/UONog.png" rel="noreferrer"><img src="https://i.stack.imgur.com/UONog.png" alt="enter image description here"></a></p>