title: SignalR For ASP.NET MVC with Angular 7 (Not ASP.NET core)
body: <p>Hi I am trying to use signalR with asp.net mvc 5 and angular 7 , but unable to establish the connection between the hub</p>
  
  <p>Here are my codes</p>
  
  <p>Angular 7</p>
  
  <pre><code>import { Component, OnInit } from '@angular/core';
  import { HubConnection, HubConnectionBuilder } from '@aspnet/signalr';
  import * as $ from '@aspnet/signalr'
  
  @Component({
  selector: 'app-admin-dashboard',
  templateUrl: './admin-dashboard.component.html',
  styleUrls: ['./admin-dashboard.component.scss']
  })
  
  export class AdminDashboardComponent implements OnInit {
  private _hubConnection: HubConnection;
  constructor() {
  this._hubConnection = new HubConnectionBuilder()
    .withUrl("http://localhost:4200/hub/cashnet", {
      skipNegotiation: true,
      transport: $.HttpTransportType.WebSockets
    })
    .configureLogging($.LogLevel.Information)
    .build();
  
  this._hubConnection.start().then(() =&gt; {
    console.log('Hub connection started');
  }).catch(err =&gt; {
    console.log('Error while establishing connection :(')
  });
  
  this._hubConnection.on('sendMessage', (MachineId: string) =&gt; {
    alert(MachineId);
  });
  }
  
  
    ngOnInit(): void { 
  }
  }
  </code></pre>
  
  <p>Startup.cs</p>
  
  <pre><code> public partial class Startup
   {
      public void Configuration(IAppBuilder app)
      {
          ConfigureAuth(app);
          app.MapSignalR(); 
      }
   }
  </code></pre>
  
  <p>Hub/CashnetHub.cs</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  using Microsoft.AspNet.SignalR;
  
  namespace CashNet_API.Hubs
  {
  public class CashnetHub : Hub
  {
      public void sendMachineUpdate(string MachineId)
      {
          Clients.All.sendMessage(MachineId);
      }
   }
  }
  </code></pre>
  
  <p>there is support for ASP.NET Core but we are not using core for this application</p>
  
  <p>this is what i am getting in console
  <a href="https://i.stack.imgur.com/4UJ4O.png" rel="nofollow noreferrer">Error in Console :img</a></p>
  
  <p>thanks in advance</p>