Unable to start Ocelot because either a ReRoute or GlobalConfiguration

在ASP.Net Core项目APIGateway中添加Ocelot+Consul而后运行时 ,VS2017报以下错 :ide

内部异常 1: Exception: Unable to start Ocelot, errors are: Unable to start Ocelot, errors are: Unable to start Ocelot because either a ReRoute or GlobalConfiguration are using ServiceDiscoveryOptions but no ServiceDiscoveryFinderDelegate has been registered in dependency injection container. Are you missing a package like Ocelot.Provider.Consul and services.AddConsul() or Ocelot.Provider.Eureka and services.AddEureka()?,Unable to start Ocelot, errors are: Unable to start Ocelot because either a ReRoute or GlobalConfiguration are using ServiceDiscoveryOptions but no ServiceDiscoveryFinderDelegate has been registered in dependency injection container. Are you missing a package like Ocelot.Provider.Consul and services.AddConsul() or Ocelot.Provider.Eureka and services.AddEureka()?

问题缘由: 容器中缺乏相应的服务it

解决办法:io

  1. install-package Ocelot.Provider.Consul
  2. ConfigureServices服务注册中修改成 : services.AddOcelot(Configuration).AddConsul();

正常运行!
若是有帮助,记得点赞~~~~容器

相关文章
相关标签/搜索