Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

connect ECONNREFUSED in Postman

Tags:

rest

c#

api

postman

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
like image 616
Anjali Avatar asked Mar 22 '20 01:03

Anjali


People also ask

What is connect Econnrefused error in Postman?

The ECONREFUSED error means that the request to establish a connection with another service was refused and that something blocks the request. There can be many reasons why your request is blocked.

How do I fix error connect Econnrefused 127.0 0.1 8080?

econnrefused means most probably you have not started your server on port 8080. ECONNREFUSED (Connection refused): No connection could be made because the target machine actively refused it. This usually results from trying to connect to a service that is inactive on the foreign host.

How do I connect to a local postman server?

Add the request URL ( localhost:4000/users ) in the appropriate textbox. In order to create a new resource in this database, we need to supply a user object to create in the body of the POST request. Select the “Body” tab and check the “raw” radio button to specify input. Press the Send button to send the POST request.


2 Answers

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.

like image 105
Sverissimo Avatar answered Oct 22 '22 11:10

Sverissimo


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

I have unchecked the Use the System roxy as Sverissimo. But still i was getting the same error. So i Disabled the SSL Certificate Verification Which is in File => Settings => General Tab(Under Request section SSL Certificate verification)

as i was just Learning API through by creating a sample project(API).

like image 1
shiga soumya Avatar answered Oct 22 '22 13:10

shiga soumya