Ocelot
Ocelot copied to clipboard
ocelot 在使用 consul 服务发现时候报错
public async Task Invoke(HttpContext httpContext) { await _next.Invoke(httpContext);
var errors = httpContext.Items.Errors();
// todo check errors is ok
if (errors.Count > 0)
{
Logger.LogWarning($"{errors.ToErrorString()} errors found in {MiddlewareName}. Setting error response for request path:{httpContext.Request.Path}, request method: {httpContext.Request.Method}");
SetErrorResponse(httpContext, errors);
}
....
配置按照:https://ocelot.readthedocs.io/en/latest/features/servicediscovery.html 配置但是在ocelot和consult中发生错误: warn: Ocelot.Responder.Middleware.ResponderMiddleware[0] requestId: 0HMD76H9KFB1L:00000002, previousRequestId: no previous request id, message: Error Code: ConnectionToDownstreamServiceError Message: Error connecting to downstream service, exception: System.Net.Http.HttpRequestException: 由于目标计算机积极拒绝,无法连接。 (quvvihifdochquz:7001) ---> System.Net.Sockets.SocketException (10061): 由于目标计算机积极拒绝,无法连接。 at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken) at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
public async Task Invoke(HttpContext httpContext) { await _next.Invoke(httpContext);
var errors = httpContext.Items.Errors(); // todo check errors is ok if (errors.Count > 0) { Logger.LogWarning($"{errors.ToErrorString()} errors found in {MiddlewareName}. Setting error response for request path:{httpContext.Request.Path}, request method: {httpContext.Request.Method}"); SetErrorResponse(httpContext, errors); }
....
配置按照:https://ocelot.readthedocs.io/en/latest/features/servicediscovery.html 配置但是在ocelot和consult中发生错误: warn: Ocelot.Responder.Middleware.ResponderMiddleware[0] requestId: 0HMD76H9KFB1L:00000002, previousRequestId: no previous request id, message: Error Code: ConnectionToDownstreamServiceError Message: Error connecting to downstream service, exception: System.Net.Http.HttpRequestException: 由于目标计算机积极拒绝,无法连接。 (quvvihifdochquz:7001) ---> System.Net.Sockets.SocketException (10061): 由于目标计算机积极拒绝,无法连接。 at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken) at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
consul版本不要使用最新版, 使用1.6.10.2即可