0

I have an existing database. It uses the asp .net identity I built in .NET 4.x. Everything in it works fine. I have run a scaffold dbcontext. I have imported a few of my files into this asp .net core project and ef core. When I attempt to login to test in my asp .net core project and see if anything works, I get an error shown below. I do not know where to track this and am not sure where to start. I think the issue has something to do with trying to scaffold the identity tables. Any suggestions are appreciated. TIA

PS. I'm trying to do this in the asp .net core 5 beta

Microsoft.Data.SqlClient.SqlException (0x80131904): Invalid column name 'Discriminator'. Invalid column name 'ProviderDisplayName'. Invalid column name 'UserId1'. at Microsoft.Data.SqlClient.SqlCommand.<>c.b__169_0(Task1 result) at System.Threading.Tasks.ContinuationResultTaskFromResultTask2.InnerInvoke() at System.Threading.Tasks.Task.<>c.<.cctor>b__277_0(Object obj) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location --- at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) --- End of stack trace from previous location --- at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable1.AsyncEnumerator.InitializeReaderAsync(DbContext _, Boolean result, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func4 operation, Func4 verifySucceeded, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable1.AsyncEnumerator.MoveNextAsync() at Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.SingleOrDefaultAsync[TSource](IAsyncEnumerable1 asyncEnumerable, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.SingleOrDefaultAsync[TSource](IAsyncEnumerable1 asyncEnumerable, CancellationToken cancellationToken) at Microsoft.AspNetCore.Identity.EntityFrameworkCore.UserStore9.FindByLoginAsync(String loginProvider, String providerKey, CancellationToken cancellationToken) at ScoringAppAndBackend.Libraries.DataAccess.Login(UserManager1 userManager, String UserName, String Password) in C:\Users\theev\source\repos\ScoringAppAndBackendCore\ScoringAppAndBackend\Libraries\DataAccess.cs:line 2184 at ScoringAppAndBackend.Controllers.MobileUserApi.MobileUserLoginController.PostAsync(MobileLogin val) in C:\Users\theev\source\repos\ScoringAppAndBackendCore\ScoringAppAndBackend\Controllers\MobileUserApi\MobileUserLoginController.cs:line 32 at lambda_method7(Closure , Object ) at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|19_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope) at Microsoft.AspNetCore.Routing.EndpointMiddleware.g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger) at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context) ClientConnectionId:8cc157c5-9ecb-422a-8927-2d4f2170e37f Error Number:207,State:1,Class:16

Wallace B. McClure
  • 1,165
  • 1
  • 15
  • 31
  • I've now done two additional items. 1. I have marked the asp net objects as [NotMapped]. this was step 1. Step 2. I have found the following url on SO and updated my schema. https://stackoverflow.com/questions/38315812/use-a-identity-2-0-database-to-authenticate-a-asp-net-core-1-0-application. – Wallace B. McClure Sep 06 '20 at 00:58
  • These two steps have resolved the error. Now, I am getting no user is found. So, I still don't have something setup right. I'm not sure what it is. – Wallace B. McClure Sep 06 '20 at 00:58
  • I spent time on this today. The issue was that the fields NormalizedUserName & NormalizedEmail must be set in the sql server db. Once I did that, problems were resolved. – Wallace B. McClure Sep 08 '20 at 00:47

0 Answers0