Spring Cloud远程调用服务时出现连接超时问题解决方法

1.idea报错:Connection timed out: connect; nested exception is java.net.ConnectException: Connection timed out: connect] with root cause

2.访问超时:访问页面如图

3.原因:服务注册到内网IP导致访问失败

4.解决方法:对服务提供者的spring配置文件中的eureka配置添加如下:

instance:
prefer-ip-address: true

 

 即可解决问题

posted @ 2019-12-30 17:03  M104  阅读(2902)  评论(0)    收藏  举报