Hello!
I have a created an MVC project, connected with my SQL management data base.
When I execute my application, and try to login or create a new user I have an error:
Server Error in '/'.
Invalid column name 'Email'.
Invalid column name 'EmailConfirmed'.
Invalid column name 'PhoneNumber'.
Invalid column name 'PhoneNumberConfirmed'.
Invalid column name 'TwoFactorEnabled'.
Invalid column name 'LockoutEndDateUtc'.
Invalid column name 'LockoutEnabled'.
Invalid column name 'AccessFailedCount'.
Description: An unhandled exception occurred during the execution of the current web request. For more information about the error and where it originated in the code, see the stack trace.
Exception Details: System.Data.SqlClient.SqlException: Invalid column name 'Email'.
Invalid column name 'EmailConfirmed'.
Invalid column name 'PhoneNumber'.
Invalid column name 'PhoneNumberConfirmed'.
Invalid column name 'TwoFactorEnabled'.
Invalid column name 'LockoutEndDateUtc'.
Invalid column name 'LockoutEnabled'.
Invalid column name 'AccessFailedCount'.
Source Error:
Riga 46: if (ModelState.IsValid)
Riga 47: {
Riga 48: var user = await UserManager.FindAsync(model.UserName, model.Password);
Riga 49: if (user != null)
Riga 50: {
File di origine: c:\Users\newbreaker\Desktop\Examen Web 2017\WebProjet2\WebProjet2\Controllers\AccountController.cs Riga: 48
What am I missing?
What I have tried:
[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public async Task<ActionResult> Login(LoginViewModel model, string returnUrl)
{
if (ModelState.IsValid)
{
var user = await UserManager.FindAsync(model.UserName, model.Password);
if (user != null)
{
await SignInAsync(user, model.RememberMe);
return RedirectToLocal(returnUrl);
}
else
{
ModelState.AddModelError("", "Invalid username or password.");
}
}
return View(model);
}
On my
Web.config I have:
<connectionStrings>
<add name="DefaultConnection" connectionString="Data Source=NEWBREAKER12\SQL2014;Initial Catalog=WebShop;Integrated Security=True" providerName="System.Data.SqlClient" />
<appSettings>
On my
Models ->
IdentityModels I have:
public ApplicationDbContext()
: base("DefaultConnection", throwIfV1Schema: false)
{
}