I created an application in Asp.net MVC using Identity and I left checked the option for Visual Studio to create the authentication of individual users for me. It turns out that I just discovered that it creates a .mdf file that contains a database and tables for storing user records. I did not know this and I ended up creating another table for my system with business rules and so on. When I put the application on the server logically, that .mdf file with the database and its tables were not and then I could not use the authentication. From there I've seen that I have a few options:
1 - Create the same exact same tables in the DB that I already use in SQL Server and use the "DefaultConnection" connection for the connection I am using from Entity. For this option, you are giving an error in my application when trying to create user or login (since I put users manually in the DB):
Detalhes da Exceção: System.InvalidOperationException: The entity type ApplicationUser is not part of the model for the current context.
Erro de Origem:
Linha 74: // Isso não conta falhas de login em relação ao bloqueio de conta
Linha 75: // Para permitir que falhas de senha acionem o bloqueio da conta, altere para shouldLockout: true
Linha 76: var result = await SignInManager.PasswordSignInAsync(model.Email, model.Password, model.RememberMe, shouldLockout: false);
Linha 77: switch (result)
Linha 78: {
Arquivo de Origem: c:\Users\sydvagner.franco\Documents\Visual Studio 2013\Projects\LPGPonto\LPGPonto\Controllers\AccountController.cs Linha: 76
2 - Try to use both databases for this application. I think it's kind of bizarre, but I'd take it if it was the simplest. In that case I would migrate the DB to SQL Server (I've seen that this is possible, but I have not tried it yet) or would put the .mdf file on the server by changing the Web.config to access that file in place as I put it on the server , rather than in | DataDirectory | as it comes from Default which is the application's App_Data folder (This folder does not appear after the system deploy, so there is no automatically created .mdf file for authentication control).
System Operation
It is an Electronic Point system that has the tables:
Tables generated in BD automatically to control user authentication
I just put the AspNetUsers and AspNetRoles tables because I thought I'd just use those.