com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server

昨天学springcloud,然后出了这么一个异常,

最后发现是只配置了Eureka的service的application.yml文件,但是我把Eureka的client的application文件给忘了。

最后如下:service

server:
  port: 7001
eureka:
  instance:
    hostname: localhost
  client:
    register-with-eureka: false
    fetch-registry: false
    service-url:
      defaultZone:  http://${eureka.instance.hostname}:${server.port}/eureka/

client

eureka:
  client:
    register-with-eureka: true
    fetch-registry: true
    service-url:
      defaultZone: http://localhost:7001/eureka/
原文地址:https://www.cnblogs.com/woyujiezhen/p/13624702.html