#StackBounty: #asp.net #angular #http #asp.net-core ERR_CONNECTION_REFUSED Asp.Net Core + Angular 10

Bounty: 50

I’m following a tutorial using Asp.net plus angular server using CORS package. Basically I’m trying to execute a post request:

 // POST: api/Trackers
        // To protect from overposting attacks, enable the specific properties you want to bind to, for
        // more details, see https://go.microsoft.com/fwlink/?linkid=2123754.
        [HttpPost]
        public async Task<ActionResult<Tracker>> PostTracker(Tracker tracker)
        {
            _context.Tracker.Add(tracker);
            await _context.SaveChangesAsync();

            return CreatedAtAction("GetTracker", new { id = tracker.entryId }, tracker);
        }

using this service on Angular Front-End:

export class TrackerDetailService {
  formData: TrackerDetail
  readonly rootURL = "http://localhost:55354/api"

  constructor(private http: HttpClient) { }

  postTracker(formData:TrackerDetail) {
      return this.http.post(this.rootURL + '/Trackers' , formData);
  }
}

and I’m getting this error:

enter image description here

I’m quite inexperienced at troubleshooting HTTP errors so any help would be appreciated.

Update: I’ve been losing my sleep over this for the past 3 days. I’ve tried a different Angular+.Net Tutorial and I’m getting stuck at the same point, not being able to send data from the front-end. 🙁 Help!


Get this bounty!!!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.