无法从基于Windows服务器(RDP)的GoLang上的其他设备运行API

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

我有基于端口1195的API GoLang,我想从其他设备运行它。我尝试过它可以在localhost上运行与Postman一起运行API。

但是当我尝试从其他设备访问API时,它无法正常工作a.k.a无法连接。

P.S:我的8080端口可以访问其他设备,但我的1195无法访问已经允许防火墙端口1195.尝试更改端口但仍然无法连接到其他设备

这是我的config.ini:

{
    "app_name"       : "HELLOWORLD_API",
    "listening_port" : "1195",
    "host"           : "127.0.0.1",
    "port"           : "3306",
    "user"           : "root",
    "passwd"         : "",
    "dbname"        : "kube71"
}

我希望在我允许端口1195之后,我可以从其他设备连接到API。

go server port rdp
1个回答
0
投票

尝试以下配置:

{ "app_name" : "HELLOWORLD_API", 
  "listening_port" : "1195", 
  "host" : "0.0.0.0", 
  "port" : "3306",
  ...
}

基本上,将127.0.0.1更改为0.0.0.0。

要了解更多信息,请查看https://superuser.com/questions/949428/whats-the-difference-between-127-0-0-1-and-0-0-0-0

简而言之,0.0.0.0意味着它可以从所有网络连接,而不仅仅是从本地连接

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