Не удалось найти подходящий конструктор для типа «RestDataService». Убедитесь, что тип конкретен и службы зарегистрированы для всех параметров общедоступного конструктора.
Код: Выделить всё
public partial class RestDataService : IRestDataService
{
private static HttpClient _client;
private static AppConfiguration _configuration;
private const short MaxRetryAttempts = 3;
private const short TimeSpanToWait = 2;
public RestDataService(AppConfiguration configuration)
{
_client = configuration.HttpClient;
_configuration = configuration;
}
........
Код: Выделить всё
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
var config = new AppConfiguration
{
Environment = Configuration["environment"],
};
services.AddMvc().AddJsonOptions(o => o.SerializerSettings.NullValueHandling = NullValueHandling.Include);
services.AddMemoryCache();
services.AddCors();
services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies());
services.AddSingleton(Configuration);
services.AddSingleton(config);
services.AddLogging();
services.AddTransient();
services.AddHttpClient()
.AddPolicyHandler(request => request.Method == HttpMethod.Get ? retryPolicy : noOp);
Подробнее здесь: https://stackoverflow.com/questions/560 ... be-located