当我尝试发送 POST 请求时,在 Postman 中连接 ECONNREFUSED

问题描述 投票:0回答:1

我正在尝试使用 postman 构建一个 api。当我想发送帖子请求时,它给了我这个错误:

发布 https://localhost:44360/api/Aufgabe 错误:连接ECONNREFUSED 127.0.0.1:44360 请求标头 内容类型:application/json 用户代理:PostmanRuntime/7.36.3 接受:/ 邮递员令牌:9391e8b8-0f88-4f74-89f0-02a627f72ef6 主机:本地主机:44360 接受编码:gzip、deflate、br 连接:保持活动状态

我想问是否有人可以帮我解决这个问题。

这是 LaunchSettings 代码:

{
  "$schema": "https://json.schemastore.org/launchsettings.json",
  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "http://localhost:35266",
      "sslPort": 44360
    }
  },
  "profiles": {
    "http": {
      "commandName": "Project",
      "dotnetRunMessages": true,
      "launchBrowser": false,
      "launchUrl": "library",
      "applicationUrl": "http://localhost:5224",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    },
    "https": {
      "commandName": "Project",
      "dotnetRunMessages": true,
      "launchBrowser": false,
      "launchUrl": "library",
      "applicationUrl": "https://localhost:7267;http://localhost:5224",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    },
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "launchUrl": "swagger",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    }
  }
}

我检查了我的防火墙设置以及邮递员中的设置,但没有任何帮助。我再次检查了我的代码和端口,一切都应该没问题。

postman
1个回答
0
投票

错误

ECONNREFUSED
表示无法与您在 URL 中提供的目的地建立连接。

我们可以通过您的代码看到您正在尝试连接到端口

127.0.0.1
处的 IP
44360

这个IP是一个环回地址,意味着它指向运行Postman的计算机。最有可能的问题是您的计算机上没有运行侦听给定端口的服务。

这不太可能是由于防火墙问题造成的,除非您有一个模糊的配置来阻止计算机对其自身的访问。

  • 使用 SSL 时验证 IIS 确实正在侦听端口
    44360
  • 尝试使用 HTTP 而不是 HTTPS 进行访问,看看是否有效
© www.soinside.com 2019 - 2024. All rights reserved.