使用 Curl 调用 Web 服务:curl 在 VMWare Ubuntu 内部工作,但在 Windows 端口 8000 外部不工作

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

我使用快速 api 和 uvicorn(端口:8000)创建 Web 服务,我需要在我的 VMWare Ubuntu 外使用 Curl 在 Windows 上调用我的 Web 服务,使用 IP 地址 192.x.x.x。和端口 8000 时 我使用了命令 ping 192.x.x.x。有连接但 ping 8000 不工作 这是我在 cmd 窗口上测试 curl 时的错误 C:> curl -u "islem:123789" http://192.x.x.x:8000/getoption/?msisdn=1234567 curl: (7) 2211 毫秒后无法连接到 192.168.177.130 端口 8000:连接被拒绝

当我在我的 cmd 窗口上测试卷曲时 C:> curl -u "islem:123789" http://192.x.x.x:8000/getoption/?msisdn=1234567 curl: (7) 2211 毫秒后无法连接到 192.168.177.130 端口 8000:连接被拒绝

python api ubuntu vmware telnet
1个回答
0
投票

我无法查看您是否在局域网内外运行 Ubuntu 实例。

如果是这样,您必须使用机器 IP,如果不是,您的 Ubuntu 实例会阻止您的传入连接,因此您必须将其设置为 not。

我无权访问您当前的设置配置,但这里有一些资源:

如何使 FastAPI 服务器从外部本地网络可用?

FastAPI/uvicorn 在指定主机时不起作用

无法使用 Uvicorn 连接到服务器

© www.soinside.com 2019 - 2024. All rights reserved.