如果我在本地运行我的应用程序(使用 localhost),它会完美运行。
但是当我决定切换到我的全球 IP 地址时(当我说全球时,我的意思不是我的局域网 IP 地址,而是我的 ISP 提供的那个)。
它只是不从我的后端加载数据。
这就是我从前端发出请求的方式:
this.http.get("http://my-isp-ip:52899/api/Student/ListStudents").subscribe(response => {
this.users = response["Users"];
});
这就是我在后端获得 applicationhost.config 的方式:
<bindings>
<binding protocol="http" bindingInformation="*:52899:localhost" />
<binding protocol="http" bindingInformation="*:52899:my-isp-ip" />
</bindings>
我像这样运行前端应用程序:
ng serve --host 0.0.0.0
而且我已经在路由器和防火墙中打开了端口。
现在,在我的路由器中,我只打开了端口:4200
因为这是在我的前端运行的端口52889
,也是在我的后端运行的端口。
我做错了什么?