Я получаю ошибку в моем проекте .net 5.0 Framework Azure долговечной функции в VS2019 < /p>
'IserviceCollection' не содержит определения для 'addPolicyHandler', а самый лучший метод расширения 'pollyhttpclientBuildExtensionsionsh IAsyncpolicy) «требуется приемник типа 'ihttpclientbuilder'
preshystrong>.
net5.0
v3
PreserveNewest
PreserveNewest
Never
startup.cs
using Microsoft.Azure.Functions.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection;
using Polly;
using Polly.Extensions.Http;
using System;
using System.Net.Http;
namespace Itel.DeliveryOrchestration
{
public class Startup : FunctionsStartup
{
public override void Configure(IFunctionsHostBuilder builder)
{
builder.Services.AddHttpClient()
.AddPolicyHandler(GetRetryPolicy());
}
private IAsyncPolicy GetRetryPolicy()
{
return HttpPolicyExtensions
.HandleTransientHttpError()
.OrResult(msg => msg.StatusCode == System.Net.HttpStatusCode.NotFound)
.WaitAndRetryAsync(2, retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt)));
}
}
}
Подробнее здесь: https://stackoverflow.com/questions/701 ... icyhandler