title: SignalR SSE handshake fails
body: <p>Hosting a ASP.Net Core 2.1 webapi and an Angular 6 webapp on "Windows Server 2008 R2" under the same domain name but different ports (:81 and :80 respectively); not contained within the same folder.</p>
  
  <p>According to <a href="https://kevgriffin.com/signalr-transports-explained/" rel="noreferrer" title="SignalR Transports Explained">this article</a>, SSE is the (standard) fallback when Websockets are unavailable, which is expected since the server doesn't support Websockets as they were introduced in IIS 8.0 (<a href="https://support.microsoft.com/en-za/help/224609/how-to-obtain-versions-of-internet-information-server-iis" rel="noreferrer" title="IIS Server Versions">server is IIS 7.5</a>)</p>
  
  <p>In development everything works perfectly. However, after publishing, the browser console reports the following after 15 seconds (suspiciously the default "HandshakeTimeout" time).</p>
  
  <pre><code>&gt; Information: SSE connected to http://my.website.com:81/notify?id=kaSkcGUjcZD4ylJAC7B70A
  &gt; Error: Connection disconnected with error 'Error: Server returned handshake error: Handshake was canceled.'.
  &gt; Error: Not Found
  </code></pre>
  
  <p>The Startup.cs is currently setup as follows:</p>
  
  <pre><code>public void ConfigureServices(IServiceCollection services)
  {
      services.AddSignalR();
      services.AddMemoryCache();
      services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
      services.AddCors(o =&gt; {
          o.AddPolicy("Limited", builder =&gt; builder
              .WithOrigins("http://my.website.com") // .AllowAnyOrigin() also tested and worked
              .AllowAnyMethod()
              .AllowAnyHeader()
              .AllowCredentials()
          );
      });
      services.AddDbContext&lt;DatabaseContext&gt;(options =&gt; {
          options.UseSqlServer(Configuration.GetConnectionString("Database"));
      });
  }
  
  public void Configure(
      IApplicationBuilder app,
      IHostingEnvironment env,
      IServiceProvider serviceProvider)
  {
      if (env.IsDevelopment())
      {
          app.UseDeveloperExceptionPage();
      }
      else
      {
          app.UseHsts();
      }
  
      app.UseCors("Limited");
      app.UseHttpsRedirection();
      app.UseMvc();
      app.UseSignalR(routes =&gt; routes.MapHub&lt;NotifyHub&gt;("/notify"));
  }
  </code></pre>
  
  <p>With the SignalR Hub being almost empty (event pushing is handled elsewhere):</p>
  
  <pre><code>public class NotifyHub : Hub
  {
      public override async Task OnConnectedAsync()
      {
          await base.OnConnectedAsync();
      }
  
      public override async Task OnDisconnectedAsync(Exception exception)
      {
          await base.OnDisconnectedAsync(exception);
      }
  }
  </code></pre>
  
  <p>The Angular service is setup as follows:</p>
  
  <pre><code>import { Injectable } from '@angular/core';
  import { HubConnection } from '@aspnet/signalr';
  import * as signalR from '@aspnet/signalr';
  import { Subject } from 'rxjs';
  
  @Injectable({
    providedIn: 'root'
  })
  export class RefreshService {
    private connection: HubConnection;
    public timestamp = new Subject&lt;string&gt;();
  
    constructor(private zone: NgZone) {
      this.connection = new signalR.HubConnectionBuilder()
        .withUrl(http://my.website.com:81/notify)
        .build();
  
      this.connection
        .start()
        .then(() =&gt; {
          this.connection.on('Message', data =&gt; {
            // Do Work
          });
        })
        .catch(err =&gt; console.error(err.toString()));
    }
  }
  </code></pre>
  
  <p>All NuGet packages are up to date (v2.1.1 for everything but Microsoft.NETCore.App which is v2.1.0) and using v1.0.2 (the latest) <a href="https://www.npmjs.com/package/@aspnet/signalr" rel="noreferrer" title="ASP.NET SignalR NPM package">ASP.NET SignalR NPM package</a> -- so the server- and client-side SignalRs are the same.</p>
  
  <p>Using a static IP address I was able to get the app to connect to a locally published API (but running IIS 10.0).</p>
  
  <p>Is there something I am missing? A lot of the technologies are pretty new, but I don't yet want to assume there's something wrong with them.</p>