在公司做微服务时,由于有的微服务用的是别人的模块,所以自己的模块在注册中心显示的其实是当前模块所在电脑的主机名,以至于在调用其他不同电脑的微服务时报错:

feign.RetryableException: Connection refused: connect executing POST http://service-log/sysLogInfoApi/findSysLogInfoByPage

 

解决方法:

在配置文件中添加:

server.port=<设置模块的端口>

#设置允许跨域
eureka.instance.prefer-ip-address=true
#这样写eureka服务注册中心会显示本机ip+端口号
eureka.instance.instance-id= ${spring.cloud.client.ipAddress}:${server.port}

 

相关文章:

  • 2022-12-23
  • 2021-12-05
  • 2021-08-08
  • 2022-12-23
  • 2022-12-23
  • 2021-06-24
  • 2021-09-11
  • 2021-07-10
猜你喜欢
  • 2021-05-17
  • 2021-05-26
  • 2021-07-15
  • 2021-11-19
  • 2021-07-07
  • 2021-09-08
  • 2022-03-09
相关资源
相似解决方案