I created a new ASP.NET Core 2.2 MVC app with a Visual Studio 2017 (15.9.7) wizard. I specified Individual Accounts option for Authentication.
After that, the only thing I added to the default template is services.AddAuthentication().AddGoogle
in Startup.ConfigureServices
method.
Running the app (the same problem under Kestrel and IISExpress), I'm getting this exception when Google authorization is complete:
An unhandled exception occurred while processing the request. SqlException: Login failed for user 'xx\yy'. System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, object providerInfo, string newPassword, SecureString newSecurePassword, bool redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, bool applyTransientFaultHandling, string accessToken)
My appsettings.json is just as it was created by the wizard:
{
"ConnectionStrings": {
"DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=aspnet-WebApplicationNetCore2-7F2E7A20-8AE2-4AB3-833A-256AC218C69E;Trusted_Connection=True;MultipleActiveResultSets=true"
},
"Logging": {
"LogLevel": {
"Default": "Warning"
}
},
"AllowedHosts": "*"
}
Found dozens of solutions on Google but neither of them worked for me.
I tried setting Trusted_Connection=False, running Update-Database in Nuget console but the same error occurs.
Found suggestions to run context.Database.EnsureCreated
in Initialize
method (ASP.Net Core : Cannot open localdb requested by the login) but I even don't have this method at all in my Startup class.
I also found that "aspnet-WebApplicationNetCore2-7F2E7A20-8AE2-4AB3-833A-256AC218C69E*.*" file does not exist anywhere under C:\Users tree. Does this mean the wizard didn't create the database at all? Didn't even try? Or did try but it failed? Not sure how to determine that.