Hyperledger REST Server Angular Web App 无法连接到本地主机之外的 REST 服务器 [英] Hyperledger REST Server Angular Web App getting could not connect to REST server outside localhost

查看:22
本文介绍了Hyperledger REST Server Angular Web App 无法连接到本地主机之外的 REST 服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在关注伟大的 Hyperledger Composer 教程这里入门.我已经设法让一切都运行起来,包括 REST 服务器和它上面的 Skeleton Angular Web 应用程序.

I'm following the great Hyperledger Composer tutorials here to getting started. I've managed to get everything running, including the REST Server and the Skeleton Angular web app on top of it.

当我尝试在本地主机之外使用应用程序时出现问题.我可以在端口 3000 上访问 REST 服务器并与之交互(添加、删除、更新).我也可以访问应用程序(端口 4200),但是当我尝试与之交互时,我得到以下信息:

Problem arise when I try to use the application outside of localhost. I can access the REST Server on port 3000 and interact with it (adding, removing, uppdating). I can also access the application (port 4200), but when I try to interact with it I get the following:

Error: Could not connect to REST server. Please check your configuration details

我尝试更新 angular-cli 以支持我当前的启动脚本:ng serve --host 0.0.0.0 --disable-host-check --public my.ip.address.here:4200 它似乎可以工作,因为我收到了有关禁用主机检查的安全警告,但它并没有解决问题.

I've tried to update the angular-cli to support my current startup script as: ng serve --host 0.0.0.0 --disable-host-check --public my.ip.address.here:4200 it seems to be working because I get the security warning about disabling host check but it's not solving the problem.

任何建议将不胜感激.先感谢您.

Any suggestions would be much appreciated. Thank you in advance.

推荐答案

我解决了.是一个简单的修复.我需要编辑文件:my-app/src/app/configuration.ts.线

I solved it. Was an easy fix. I needed to edit the file: my-app/src/app/configuration.ts. The line

public ApiIP: string = "localhost";

将其更改为您的外部 IP.

Change that to your external IP.

这篇关于Hyperledger REST Server Angular Web App 无法连接到本地主机之外的 REST 服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆