diff --git a/Myshipping.Application/Service/BookingOrder/BookingValueAddedService.cs b/Myshipping.Application/Service/BookingOrder/BookingValueAddedService.cs index dbe11f3a..f60956d8 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingValueAddedService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingValueAddedService.cs @@ -692,7 +692,10 @@ namespace Myshipping.Application { _logger.LogInformation("批次={no} 对应请求报文 request={res}", batchNo, JSON.Serialize(info)); - var res = await url.SetHttpMethod(HttpMethod.Post) + var res = await url.OnClientCreating(client => { + // client 为 HttpClient 对象 + client.Timeout = TimeSpan.FromMinutes(15); // 设置超时时间 15分钟 + }).SetHttpMethod(HttpMethod.Post) .SetBody(JSON.Serialize(info), "application/json") .SetContentEncoding(Encoding.UTF8) .PostAsync(); @@ -741,7 +744,10 @@ namespace Myshipping.Application { _logger.LogInformation("批次={no} 对应请求报文 request={res}", batchNo, JSON.Serialize(info)); - var res = await url.SetHttpMethod(HttpMethod.Post) + var res = await url.OnClientCreating(client => { + // client 为 HttpClient 对象 + client.Timeout = TimeSpan.FromMinutes(15); // 设置超时时间 15分钟 + }).SetHttpMethod(HttpMethod.Post) .SetBody(JSON.Serialize(info), "application/json") .SetContentEncoding(Encoding.UTF8) .PostAsync(); @@ -791,7 +797,10 @@ namespace Myshipping.Application { _logger.LogInformation("批次={no} 对应请求报文 request={res}", batchNo, JSON.Serialize(info)); - var res = await url.SetHttpMethod(HttpMethod.Post) + var res = await url.OnClientCreating(client => { + // client 为 HttpClient 对象 + client.Timeout = TimeSpan.FromMinutes(15); // 设置超时时间 15分钟 + }).SetHttpMethod(HttpMethod.Post) .SetBody(JSON.Serialize(info), "application/json") .SetContentEncoding(Encoding.UTF8) .PostAsync();