ocelot consul 的问题 0.0.0.1:5224 错误代码10051
解决
官网上说的 做了修改

代码
public class MyConsulServiceBuilder : DefaultConsulServiceBuilder { public MyConsulServiceBuilder(IHttpContextAccessor contextAccessor, IConsulClientFactory clientFactory, IOcelotLoggerFactory loggerFactory) : base(contextAccessor, clientFactory, loggerFactory) { } // Use the agent service IP address as the downstream hostname protected override string GetDownstreamHost(ServiceEntry entry, Node node) => entry.Service.Address; }
使用
builder.Services.AddOcelot().AddConsul<MyConsulServiceBuilder>().AddPolly().AddCacheManager(p =>
{
p.WithDictionaryHandle();
});
浙公网安备 33010602011771号