在 Postman 中连接 ECONNREFUSED [英] connect ECONNREFUSED in Postman
问题描述
我正在尝试通过邮递员测试我的 REST API,但出现以下错误:
I am trying to test my REST API through postman and I am getting the following error:
这是我编写的第一个 REST API,我对邮递员很陌生,所以不确定我做错了什么.下面是我试图用这个 URL 调用邮递员的代码.我在 URL 中传递两个日期参数
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
代码如下:
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:
当我尝试通过将此 URL 放入浏览器来直接运行 API 时,我收到错误消息:
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.
推荐答案
我遇到了同样的错误.这解决了我的问题:
I was getting the same error. This solved my issue:
文件 ->设置 ->代理,然后取消标记使用系统代理"
File -> Settings -> Proxy, then unmark "Use the system proxy"
请注意,我仅将 Postman 用于开发(本地主机),因此我禁用了代理.
Notice that I'm using Postman only for development (localhost), so I disabled the proxy.
这篇关于在 Postman 中连接 ECONNREFUSED的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!