When passing MailService to my Controller's constructor my app throws a System.InvalidOperationException. However, when I switch it out for the interface, it works. What is the reason for this?
In Startup.cs
services.AddScoped<IMailService, MailService>();
In my Controller
private IMailService MailService { get; }
public AccountController(UserManager<ApplicationUser> userManager, SignInManager<ApplicationUser> signInManager, MailService mailService)
{
    if (userManager == null)
        throw new ArgumentNullException(nameof(userManager));
    if (signInManager == null)
        throw new ArgumentNullException(nameof(signInManager));
    if (mailService == null)
        throw new ArgumentNullException(nameof(mailService));
    this.UserManager = userManager;
    this.SignInManager = signInManager;
    this.MailService= mailService;
}
Many thanks!
 
     
    