App无法连接到本地主机以外的REST服务器

App无法连接到本地主机以外的REST服务器

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

问题描述

我正在跟踪伟大的Hyperledger Composer教程此处至入门.我设法使所有内容运行起来,包括REST Server和最上面的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.

当我尝试在localhost之外使用应用程序时出现问题.我可以在端口3000上访问REST Server并与其进行交互(添加,删除,更新).我也可以访问该应用程序(端口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服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 19:45