Register Services in Program Class File - bondaigames/ASP.NET-Core-Documentation GitHub Wiki
// Add services to the container.
builder.Services.AddControllersWithViews();
// Add these lines
builder.Services.AddHttpContextAccessor();
builder.Services.AddHttpClient();
builder.Services.AddHttpClient<ICouponService, CouponService>();
SD.CouponAPIBase = builder.Configuration["ServiceUrls:CouponAPI"];
// Add Scope
builder.Services.AddScoped<IBaseService, BaseService>();
builder.Services.AddScoped<ICouponService, CouponService>();