简体   繁体   English

无法连接到服务器上运行的Java应用程序(Heroku)

[英]unable connect to java app running on server (Heroku)

I deployed my app on Heroku. 我在Heroku上部署了我的应用程序。 It is a simple app that will throw back the message sent from its client version (running on my PC) back to the client. 这是一个简单的应用程序,它将从客户端版本(在我的PC上运行)发送的消息回传给客户端。 My server app prints the IP address of the machine it's running on so I can connect to it from my client . 我的服务器应用程序会打印正在运行的计算机的IP地址,这样我就可以从客户端连接到它了。 I do get to see the IP address of Heroku machine when I deploy and run it. 部署和运行时,确实可以看到Heroku机器的IP地址。 However, I am not able to connect to it from my client version using that IP address(Connection timed out) . 但是,我无法使用该IP地址从客户端版本连接到它(连接超时)。 I have allowed the port I am using in my firewalls. 我已经在防火墙中使用了我正在使用的端口。 I don't understand what I am doing wrong . 我不明白我在做什么错。

Pls help me solve it. 请帮我解决。

If you need to see my code let me know ( the app works fine locally on different terminals so I don't think it has a problem). 如果您需要查看我的代码,请告诉我(该应用在不同终端上可以在本地正常运行,因此我认为它没有问题)。

Your Heroku dyno (an isolated server) is behind a router. 您的Heroku dyno(隔离服务器)位于路由器后面。 You can't use the IP address to connect to it. 您不能使用IP地址连接到它。

Instead, you the URL https://[appname].herokuapp.com where "[appname]" is the name of your app. 而是使用URL https:// [appname] .herokuapp.com ,其中“ [appname]”是您的应用程序的名称。

You can also run heroku open from the command line. 您也可以从命令行运行heroku open

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM