There is hosting issue of an application on IIS server made in .NET Core MVC using the Microsoft.AspNetCore.Identity.EntityFramework
package that manages roles. Here we are getting an error that a particlar table/obj (AspNetUser) made by IdentityManager is invalid, but the DB and tables exist.
try
{
var signInResult = await signInManager.PasswordSignInAsync(loginRequest.Username, loginRequest.Password, false, false);
if (signInResult != null && signInResult.Succeeded)
{
if (!string.IsNullOrWhiteSpace(loginRequest.ReturnUrl))
{
return Redirect(loginRequest.ReturnUrl);
}
return RedirectToAction("Index", "Home");
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.Write(ex.ToString());
}
This is what we tried error we are getting in the first line of try block i.e. signInResult.
Solution
Thank you all for your valuable responses and support throughout this troubleshooting process. I sincerely appreciate your time and effort in helping me resolve the issue.
After carefully reviewing the situation, I realized that the problem was caused by having two separate databases with different connection strings. To rectify this, I decided to delete both databases and all migration files. Instead, I created a single database containing all the necessary tables.
As a result, the application is now functioning flawlessly, and the login process is working perfectly fine.
Once again, I am grateful for your assistance and kindness. Your contributions were instrumental in finding the solution. Thank you!