Angular gives me ERROR X when I buld a project

57 views Asked by At

What am I doing wrong?

I don't know why I get this error. I do have 2 Angular 17 services. When I build the first one, everything is working with no erorr or issue. I duplicate the 1st one to the 2nd one and then I modify its methods (access to .net Apicontrollers). When I build the project then I got the message. Also, I try to create a brand new service (similar to the first one) and I still get the message. The only way NOT TO SEE the message is to delete the 2nd service from the project completely.

constructor(
    private http: HttpClient, 
    public router: Router
    ) 
    {
    this.apiURL = environment.apiUrl;
  }

my method to access (there is only one method in the service) the .Net API controller which is related to error message

  getRecords(): Observable<any[]> {
     return this.http.get<any[]>(this.apiURL + 'LinkWebTube/GetLinktubes')
  } 
PS C:\Users\admin\source\repos\playground\Playground\ClientApp\src> ng build
⠇ Building...
ERROR X {
  headers: n {
    normalizedNames: Map(0) {},
    lazyUpdate: null,
    headers: Map(0) {}
  },
  status: 0,
  statusText: 'Unknown Error',
  url: 'https://localhost:7131/LinkWebTube/GetLinktubes',
  ok: false,
  name: 'HttpErrorResponse',
  message: 'Http failure response for https://localhost:7131/LinkWebTube/GetLinktubes: 0 undefined',
  error: TypeError: fetch failed
      at Object.fetch (node:internal/deps/undici/undici:11457:11)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
    cause: Error: connect ECONNREFUSED ::1:7131
        at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1494:16) {
      errno: -4078,
      code: 'ECONNREFUSED',
      syscall: 'connect',
      address: '::1',
      port: 7131
    }
  }
0

There are 0 answers