In Move ASP.NET Identity store to EF Sql database zoidbergi described an issue similar to that which I\'m experiencing, but which was not completely answered. I am receiving
(INELEGANT?) SOLUTION:
I watched this excellent video https://www.youtube.com/watch?v=elfqejow5hM by Alexander Schmidt and at 33:00 the author reveals that the connection string should not be an EF connection string (using the EF provider) but should be a vanilla MYSQL/SQLServer connection string specifically set up for security, ie:
<add name="IMSSecurityEntities" connectionString="data source=localhost;database=mydb;Uid=id;Pwd=password;" providerName="mysql.data.mysqlclient"/>
and similarly the identity model should be adjusted to:
Public Class ApplicationDbContext
Inherits IdentityDbContext(Of ApplicationUser)
Public Sub New()
MyBase.New("IMSSecurityEntities")
End Sub
This makes me nervous about accessing the security entities through the ORM - but I guess may well be by design so maybe no loss.
In my case it was the providerName
property of the connection string. I used a copy of Database First generated connection string which uses System.Data.EntityClient
while normal connection strings (to SQL Server) use System.Data.SqlClient
. So I changed this
<add name="DefaultConnection" connectionString="..." System.Data.EntityClient"/>
to this
<add name="DefaultConnection" connectionString="..." System.Data.SqlClient"/>