我正在尝试通过邮递员测试我的REST API,但出现以下错误:
I am trying to test my REST API through postman and I am getting the following error:
这是我编写的第一个REST API,对于邮递员来说我是一个新手,所以不确定我在做什么错.以下是我尝试使用此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
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); } } }在其他选项卡下,授权,标头,正文,PreRequest脚本,邮递员的测试和设置下没有任何内容.以下是邮递员的屏幕截图:
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: localhost:44360/api/RecLoadPrime/insertRecLoadData/?RecStartDate=01/01/2020&RecEndDate=01/02/2020任何帮助将不胜感激.
推荐答案我遇到了同样的错误.这解决了我的问题:
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.
更多推荐
在邮递员中连接ECONNREFUSED
发布评论