我知道我可以指定 HTTP 错误代码列表(例如 408、502、503 等)我想使用 Polly 重试,但是如果没有指定,默认情况下将重试的这些代码的列表是什么?
最佳答案
What is the list of [Http status] codes that would be retried by default [by Polly] if none is specified?
Polly 本身不包含它重试内容的内置定义:您作为用户 specify that when defining a policy .
Polly 和 HttpClientFactory(使用
services.AddHttpClient(...).AddTransientHttpErrorPolicy(...)
in StartUp
in .Net Core)根据 Polly with HttpClientFactory documentation 重试以下项目:此 should also be shown in the intellisense当您将鼠标悬停在方法上时。
.HandleTransientHttpError()
方法可通过 Polly.Extensions.Http
获得还包handles the same set of exceptions and status codes .
关于.net - 默认情况下,Polly (.Net) 会重试哪些 HTTP 错误代码?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54699826/