0

I have a problem between Angular and .Net-Core after I publish to IIS.

The app runs fine on my local machine but when I publish to IIS the Angular app can't talk to the .Net app.

I can see the home page, but can't do a search on the page (which communicates with the API and DB)

Where do I start to debug this? What can I do to debug where the error is coming from?

Should I start looking at the configuration between the two apps or something on the server (IIS)?

I have an error.interceptor.ts file that does this:

export class ErrorInterceptor implements HttpInterceptor {
  intercept(request: HttpRequest < any > , next: HttpHandler): Observable < HttpEvent < any >> {
    return next.handle(request)
      .pipe(
        catchError((error: HttpErrorResponse) => {
          let errorMessage = '';
          if (error.error instanceof ErrorEvent) {
            // client-side error
            errorMessage = `Error: ${error.error.message}`;
          } else {
            // server-side error
            errorMessage = `Error Code: ${error.status}\nMessage: ${error.message}\nStatusText: ${error.statusText}`;
          }
          window.alert(errorMessage);
          return throwError(errorMessage);
        })
      );
  }
}

and in the window alert I see this

enter image description here

chuckd
  • 13,460
  • 29
  • 152
  • 331
  • Does this answer your question? [SCRIPT7002: XMLHttpRequest: Network Error 0x2ef3, Could not complete the operation due to error 00002ef3](https://stackoverflow.com/questions/14527387/script7002-xmlhttprequest-network-error-0x2ef3-could-not-complete-the-operati) – Mohsin Mehmood Jan 15 '20 at 10:33
  • Can you give more information ? endpoint, type of http call and so on. Open the angular app with developer tools and watch the network tab for this call and see the request/response – alim Jan 15 '20 at 19:05
  • It looks like I'm receiving a "zone-evergreen.js:2952 GET http://localhost:5001/api/claim?pageNumber=1&pageSize=10 net::ERR_CONNECTION_REFUSED" from the Chrome dev tool – chuckd Jan 15 '20 at 19:21
  • make sure your application is listing to the particular port, and that port is not blocked. also set the right permission to the site folder and DB.enable the asp.net core module stdout logging feature. check the event viewer application log. please refer this link for more detail: https://stackoverflow.com/questions/56394751/how-to-deploy-angular-and-net-core-web-api-on-iis – Jalpa Panchal Jan 16 '20 at 07:06

0 Answers0