In Startup.cs this was registered as;
public void ConfigureServices(IServiceCollection services) {
services.AddMicrosoftIdentityWebAppAuthentication(Configuration)
.EnableTokenAcquisitionToCallDownstreamApi()
.AddInMemoryTokenCaches();
services.AddScoped(typeof(PowerBiServiceApi));
And called in Controller as:
[Authorize]
public class HomeController : Controller
{
private PowerBiServiceApi powerBiServiceApi;
public HomeController(PowerBiServiceApi powerBiServiceApi)
{
this.powerBiServiceApi = powerBiServiceApi;
}
I get an error of "InvalidOperationException: Unable to resolve service for type 'AppOwnsData.Services.PowerBiServiceApi' while attempting to activate 'AppOwnsData.Controllers.HomeController'. "
In Startup.cs this was registered as;
public void ConfigureServices(IServiceCollection services) {
And called in Controller as:
[Authorize]
public class HomeController : Controller
{
private PowerBiServiceApi powerBiServiceApi;
I get an error of "InvalidOperationException: Unable to resolve service for type 'AppOwnsData.Services.PowerBiServiceApi' while attempting to activate 'AppOwnsData.Controllers.HomeController'. "