Angular + .NET POST error: RRS feed

  • Question

  • User-765246669 posted

    Hey folks I'm using Cors to get my angular application to interact with the database through .NET WebAPI but I'm getting the following error:

    core.js:4197 ERROR 
    HttpErrorResponse {headers: HttpHeaders, status: 0, statusText: "Unknown Error", url: "https://localhost:44398/api/main_tb", ok: false, …}
    error: ProgressEvent {isTrusted: true, lengthComputable: false, loaded: 0, total: 0, type: "error", …}
    headers: HttpHeaders {normalizedNames: Map(0), lazyUpdate: null, headers: Map(0)}
    message: "Http failure response for https://localhost:44398/api/main_tb: 0 Unknown Error"
    name: "HttpErrorResponse"
    ok: false
    status: 0
    statusText: "Unknown Error"
    url: "https://localhost:44398/api/main_tb"
    __proto__: HttpResponseBase

    Here's the post on the controller:

            public IHttpActionResult Postmain_tb(main_tb main_tb)
                if (!ModelState.IsValid)
                    return BadRequest(ModelState);
                return CreatedAtRoute("DefaultApi", new { id = main_tb.SleepId }, main_tb);

    Let me know if I need to post the angular code for more info. Any help is appreciated. 

    Saturday, August 1, 2020 12:35 AM

All replies

  • User-474980206 posted

    You should use the browsers network trace to see the actual response. 

    Saturday, August 1, 2020 4:39 PM