title: How to fix "err connection refused" in angular
body: <p>I am building an web application with webApi and angular 7 .
  The webApi part works because when I run dotnet watch run it brings my data from the database in the browser but when I connect it with angular I get err connection refused.</p>
  
  <p>I checked the url. It is correct</p>
  
  <p>This is my service.ts :</p>
  
  <pre><code>const httpOptions = {
  headers: new HttpHeaders({ 'Content-Type': 'application/json' })
  };
  const apiUrl = 'http://localhost:5000/api';
  
  @Injectable({
  providedIn: 'root'
  })
  export class ApiService {
  
   constructor(private http: HttpClient) { }
  
  
  
  
   private handleError&lt;T&gt;(operation = 'operation', result?: T) {
  return (error: any): Observable&lt;T&gt; =&gt; {
  
    // TODO: send the error to remote logging infrastructure
    console.error("emptyyyyyy"); // log to console instead
  
    // Let the app keep running by returning an empty result.
    return of(result as T);
  };
  }
  
   getEmployees(): Observable&lt;Employee[]&gt; {
   return this.http.get&lt;Employee[]&gt;(apiUrl)
    .pipe(
  
      catchError(this.handleError('getSuppliers', []))
    );
    }
  
  
  }
  </code></pre>
  
  <p>In the console it sayss : emptyyy and err connection refused</p>