C# – connect ECONNREFUSED in Postman

apicpostmanrest

I am trying to test my REST API through postman and I am getting the following error:

enter image description here

This is my first REST API that I have written and I am very new to postman so not sure what am I doing wrong. Below is my code that I am trying to call in postman with this URL. I am passing two date parameters in the URL

https://localhost:44360/api/RecLoadPrime/insertRecLoadData/?RecStartDate=01/01/2020&RecEndDate=01/02/2020

Below is the code:

using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Threading.Tasks;
    using Microsoft.AspNetCore.Http;
    using Microsoft.AspNetCore.Mvc;
    using RecLoad.DAL;

    namespace RecLoad.Controllers
    {
        [Route("api/[controller]")]
        [ApiController]
        public class RecLoadPrimeController : ControllerBase
        {

            [Route("RecLoadPrime/insertRecLoadData/{RecStartDate}/{RecEndDate}")]
            [HttpPost]
            public void insertRecLoadData(string RecStartDate, string RecEndDate)
            {
                RecLoadDataProvider dataProvider = new RecLoadDataProvider();
                dataProvider.InsertData(RecStartDate, RecEndDate);
            }
        }
    }

There is nothing under the other tabs, Authorization, Headers, Body, PreRequest scripts, Test and settings of postman. Below is the screen shot from postman:

enter image description here

when I trying to run the API directly by putting this URL in the browser, I am getting the error saying:

This localhost page can’t be foundNo webpage was found for the web address: https://localhost:44360/api/RecLoadPrime/insertRecLoadData/?RecStartDate=01/01/2020&RecEndDate=01/02/2020

any help will be highly appreciated.

Best Answer

I was getting the same error. This solved my issue:

File -> Settings -> Proxy, then unmark "Use the system proxy"

Notice that I'm using Postman only for development (localhost), so I disabled the proxy.

Related Topic