简体   繁体   中英

Failed to load resource: net::ERR_CONNECTION_RESET in angular

  1. I'm trying to submit my form which has name and email and submit button. When I click on the submit button the page is not redirecting to another page, but instead it shows me this error in console:

     ERROR HttpErrorResponse {headers: HttpHeaders, status: 0, statusText: "Unknown Error", url: null, ok: false, …} error: ProgressEvent bubbles: false cancelBubble: false cancelable: false composed: false currentTarget: XMLHttpRequest {__zone_symbol__xhrSync: false, __zone_symbol__xhrURL: "http://localhost:44371/api/InsertParticipant", __zone_symbol__loadfalse: Array(1), __zone_symbol__errorfalse: null, __zone_symbol__xhrScheduled: true, …} defaultPrevented: false eventPhase: 0 isTrusted: true lengthComputable: false loaded: 0 path: [] returnValue: true srcElement: XMLHttpRequest {__zone_symbol__xhrSync: false, __zone_symbol__xhrURL: "http://localhost:44371/api/InsertParticipant", __zone_symbol__loadfalse: Array(1), __zone_symbol__errorfalse: null, __zone_symbol__xhrScheduled: true, …} target: XMLHttpRequest {__zone_symbol__xhrSync: false, __zone_symbol__xhrURL: "http://localhost:44371/api/InsertParticipant", __zone_symbol__loadfalse: Array(1), __zone_symbol__errorfalse: null, __zone_symbol__xhrScheduled: true, …} timeStamp: 157745.79999991693 total: 0 type: "error" __proto__: ProgressEvent headers: HttpHeaders {normalizedNames: Map(0), lazyUpdate: null, headers: Map(0)} message: "Http failure response for (unknown url): 0 Unknown Error" name: "HttpErrorResponse" ok: false status: 0 statusText: "Unknown Error"

Failed to load resource : net::ERR_CONNECTION_RESET at localhost:44371/api/InsertParticipant

  1. Here I'm doing a webAPI using c#.net where at localhost:44371/api/InsertParticipant.

  2. When i click on submit the page should redirect from http://127.0.0.1:4200/register to http://127.0.0.1:4200/quiz , but it is not redirecting to http://127.0.0.1:4200/quiz .

  3. If you need more details I will help you.
  4. What is the issue in the code?
  5. How to remove the error? If needed I will give you a screenshot.

I faced with the similar problem. In my case the solution was very trivial: Webapi in fact was launched on https ://localhost:44381, but in my js client I tried to fetch data from http://localhost:44381. So, look carefully to link where your api launched.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM