AspNetCore.SignalR 2.1 and CORS

This didn't work for me and a subtly different version did -

public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
  ...
  app.UseCors(builder => builder
    .AllowAnyHeader()
    .AllowAnyMethod()
    .SetIsOriginAllowed((host) => true)
    .AllowCredentials()
  );

  app.UseSignalR(routes => { routes.MapHub<ChatHub>("/chatHub"); });
  app.UseMvc();
}

Try to move app.UseSignalR() on top of app.UseMvc() like this

app.UseCors("AllowCors");
app.UseSignalR(routes =>
    {
        routes.MapHub<TestHub>("/test");
    });
app.UseMvc();