I'm working on some movie project. After the make some arrangements on HomeController this error showed up. I tried everything i could find on internet but cant solve it.
Here is my full error message.
InvalidOperationException: Unable to resolve service for type 'Microsoft.AspNetCore.Identity.UserManager`1[OnlineMovieTicketBookingProject.Models.ApplicationUser]' while attempting to activate 'OnlineMovieTicketBookingProject.Controllers.HomeController'.
HomeController.cs
public class HomeController : Controller
{
int count = 1;
bool flag = true;
private UserManager<ApplicationUser> _usermanager;
private ApplicationDbContext _context;
public HomeController(ApplicationDbContext context, UserManager<ApplicationUser> usermanager)
{
_context = context;
_usermanager = usermanager;
}
...
}
Startup.cs
public void ConfigureServices(IServiceCollection services)
{
services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
services.AddDatabaseDeveloperPageExceptionFilter();
services.AddDefaultIdentity<IdentityUser>(options => options.SignIn.RequireConfirmedAccount = true)
.AddEntityFrameworkStores<ApplicationDbContext>();
services.AddControllersWithViews();
services.AddTransient<UploadInterface, uploadfilerepo>();
}