为applicationuser创建属性的问题 [英] Problem creating property for applicationuser

查看:334
本文介绍了为applicationuser创建属性的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好!我正在为ApplicationUser创建一个ASP.NET Core 2.0属性。我以前已经这样做了,但现在它似乎不允许我这样做。



我的ApplicationUser类是这样的:



Hello! I am creating an ASP.NET Core 2.0 property to ApplicationUser. I already have done that in the past, but now it does not seem to allow me to do it.

My ApplicationUser class is this:

public class ApplicationUser : IdentityUser
{
    [Required]
    public string FirstName { get; set; }

    [Required]
    public string LastName { get; set; }

    [Required]
    public DateTime RegistrationDate { get; set; }

    [Required]
    public bool Banned { get; set; }
}



我尝试通过执行此命令添加新添加的属性Banned:




I try to add the newly added property "Banned" by executing this command:

add-migration AddBannedToApplicationUser





这是控制台中的结果:< br $> b $ b



And this is the result in the console:

Quote:

PM> add-migration AddBannedToApplicationUser

Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager [0]

用户个人资料可用。使用'C:\Users\miche\AppData \ Local \ ASPP.NET \ DataProtection-Keys'作为密钥存储库,使用Windows DPAPI加密静态密钥。

Microsoft.EntityFrameworkCore .Infrastructure [10403]

实体框架核心2.1.1-rtm-30846使用提供者'Microsoft.EntityFrameworkCore.SqlServer'初始化'ApplicationDbContext',其中包含以下选项:无

Microsoft。 EntityFrameworkCore.Database.Command [20101]

执行DbCommand(61ms)[Parameters = [@__ normalizedName_0 ='?'(Size = 256)],CommandType ='Text',CommandTimeout = '30']

SELECT TOP(1)[r]。[Id],[r]。[ConcurrencyStamp],[r]。[Name],[r]。[NormalizedName]

FROM [AspNetRoles] AS [r]

WHERE [r]。[NormalizedName] = @__ normalizedName_0

Microsoft.EntityFrameworkCore.Database.Command [20101]

执行DbCommand(0ms)[Parameters = [@__ normalizedName_0 ='?'(Size = 256)],CommandType ='Text ,CommandTimeout = '30']

SELECT TOP(1)[r]。[Id],[r]。[ConcurrencyStamp],[r]。[Name],[r]。[NormalizedName ]

来自[AspNetRoles] AS [r]

WHERE [r]。[NormalizedName] = @__ normalizedName_0

失败:Microsoft.EntityFrameworkCore。 Database.Command [20102]

执行DbCommand失败(2ms)[Parameters = [@__ normalizedEmail_0 ='?'(Size = 256)],CommandType ='Text',CommandTimeout = '30']

SELECT TOP(1)[u]。[Id],[u]。[AccessFailedCount],[u]。[Banned],[u]。[ConcurrencyStamp],[u]。[Email ],[u]。[EmailConfirmed],[u]。[FirstName],[u]。[LastName],[u]。[LockoutEnabled],[u]。[LockoutEnd],[u]。[NormalizedEmail], [u]。[NormalizedUserName],[u]。[PasswordHash],[u]。[PhoneNumber],[u]。[PhoneNumberConfirmed],[u]。[RegistrationDate],[u]。[SecurityStamp],[u ]。[TwoFactorEnabled],[u]。[UserName]

FROM [AspNetUsers] AS [u]

WHERE [u]。[NormalizedEmail] = @__ normalizedEmail_0

系统tem.Data.SqlClient.SqlException(0x80131904):无效的列名'禁止'。

在System.Data.SqlClient.SqlCommand。<> c。< executedbdatareaderasync> b__108_0(任务`1 System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()

在System.Threading.ExecutionContext.Run(ExecutionContext executionContext,ContextCallback回调,对象状态)

在System.Threading.Tasks.Task.ExecuteWithThreadLocal(任务& currentTaskSlot)

---从抛出异常的上一个位置开始的堆栈跟踪结束---

在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)

在Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand。< executeasync> d__17.MoveNext()

ClientConnectionId:a12367ae-8fc6-4974-a289-7b7a4130cd92

错误号码:207,状态:1,类:16

失败:Microsoft.EntityFrameworkCore。查询[10100]

在迭代上下文类型'contractme.Data.ApplicationDbContext'的查询结果时,数据库发生异常。

System.Data.SqlClient。 SqlException(0x80131904):无效的列名'禁止'。

在System.Data.SqlClient.SqlCommand。<> c。< executedbdatareaderasync> b__108_0(任务`1结果)
System.Threa的
ding.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()

在System.Threading.ExecutionContext.Run(ExecutionContext executionContext,ContextCallback回调,对象状态)

在System.Threading。 Tasks.Task.ExecuteWithThreadLocal(任务&安培; currentTaskSlot)

---从抛出异常的上一个位置开始的堆栈跟踪结束---

在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)

在Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand。< executeasync> d__17.MoveNext()

---从抛出异常的上一个位置开始的堆栈跟踪结束---

在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)

at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable`1.AsyncEnumerator。< bufferlessmovenext> d__12.MoveNext()

---从抛出异常的先前位置开始的堆栈跟踪结束---

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at Microsoft.EntityFrameworkCore.Storage.Internal .SqlServerExecutionStrategy。< executeasync> d__7`2.MoveNext()

---从抛出异常的上一个位置开始的堆栈跟踪结束---

在System。 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)上的
运行时.ExceptionServices.ExceptionDispatchInfo.Throw()

at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable` 1.AsyncEnumerator。< movenext> d__11.MoveNext()

---从抛出异常的上一个位置开始的堆栈跟踪结束---

在System.Runtime System.Runtime.CompilerServices上的.ExceptionServices.ExceptionDispatchInfo.Throw()

。 SystemAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)

at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()

at System.Linq.AsyncEnumerable。< firstordefault_> d__165`1.MoveNext()

---从抛出异常的上一个位置开始的堆栈跟踪结束---

在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw ()

在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)

at Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.TaskResultAsyncEnumerable`1.Enumerator。< ; movenext> d__3.MoveNext()

---从抛出异常的上一个位置开始的堆栈跟踪结束---

在System.Runtime.ExceptionServices.ExceptionDispatchInfo。在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAn中抛出()

dDebuggerNotification(任务任务)

at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()

at System.Linq.AsyncEnumerable.SelectEnumerableAsyncIterator`2。< movenextcore> d__7.MoveNext()

---从抛出异常的上一个位置开始的堆栈跟踪结束---

在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw ()

在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)

在System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
。< movenext> d__10.MoveNext()

---从抛出异常的上一个位置开始的堆栈跟踪结束 - -

在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

在System.Runtime.Co mpilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)

at Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.ExceptionInterceptor`1.EnumeratorExceptionInterceptor。< movenext> d__5.MoveNext()

ClientConnectionId:a12367ae-8fc6-4974-a289-7b7a4130cd92

错误号码:207,状态:1,类:16

System.Data.SqlClient.SqlException(0x80131904) :无效的列名称'禁止'。

在System.Data.SqlClient.SqlCommand。<> c。< executedbdatareaderasync> b__108_0(任务`1结果)

在System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()

在System.Threading.ExecutionContext.Run(ExecutionContext executionContext,ContextCallback回调,对象状态)

在系统.Threading.Tasks.Task.ExecuteWithThreadLocal(任务&安培; currentTaskSlot)

---从抛出异常的上一个位置开始的堆栈跟踪结束---

在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)

在Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand。< executeasync> d__17.MoveNext()

---从抛出异常的上一个位置开始的堆栈跟踪结束---

在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)

at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable`1.AsyncEnumerator。< bufferlessmovenext> d__12.MoveNext()

---从抛出异常的先前位置开始的堆栈跟踪结束---

在System.Runtime.ExceptionServices.ExceptionDispatchIn fo.Throw()

在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)

在Microsoft.EntityFrameworkCore.Storage.Internal.SqlServerExecutionStrategy。< executeasync> d__7`2.MoveNext()

---从抛出异常的上一个位置开始的堆栈跟踪结束---

在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw ()

在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)

at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable`1.AsyncEnumerator。< movenext> ; d__11.MoveNext()

---从抛出异常的上一个位置开始的堆栈跟踪结束---

在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw( )

在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)

在System.Runtime.CompilerServices.Co nfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()

在System.Linq.AsyncEnumerable。< firstordefault_> d__165`1.MoveNext()

---堆栈跟踪结束从抛出异常的先前位置---

在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)

at Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.TaskResultAsyncEnumerable`1.Enumerator。< movenext> d__3.MoveNext()

---栈尾从抛出异常的先前位置追踪---

在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)

在System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()

在System.Li nq.AsyncEnumerable.SelectEnumerableAsyncIterator`2。< movenextcore> d__7.MoveNext()

---从抛出异常的上一个位置开始的堆栈跟踪结束---

在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)

在System.Runtime.CompilerServices.ConfiguredTaskAwaitable `1.ConfiguredTaskAwaiter.GetResult()

在System.Linq.AsyncEnumerable.AsyncIterator`1。< movenext> d__10.MoveNext()

---栈尾从抛出异常的先前位置追踪---

在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)

at Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.ExceptionInterceptor`1.EnumeratorExceptionInterceptor。< move下一个> d__5.MoveNext()

ClientConnectionId:a12367ae-8fc6-4974-a289-7b7a4130cd92

错误号码:207,状态:1,等级:16

应用程序启动异常:System.AggregateException:发生一个或多个错误。 (无效的列名称'禁止'。)---> System.Data.SqlClient.SqlException:无效的列名'禁止'。

在System.Data.SqlClient.SqlCommand。<> c。< executedbdatareaderasync> b__108_0(任务`1结果)<在System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()

at System.Threading.ExecutionContext.Run(ExecutionContext executionContext,ContextCallback callback,Object state)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)

---从抛出异常的上一个位置开始的堆栈跟踪结束---

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)

at Microsoft.EntityFrameworkCore。 Storage.Internal.RelationalCommand。< executeasync> d__17.MoveNext()

---从抛出异常的上一个位置开始的堆栈跟踪结束---

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at Microsoft.EntityFrameworkCore.Query。 Internal.AsyncQueryingEnumerable`1.AsyncEnumerator。< bufferlessmovenext> d__12.MoveNext()

---从抛出异常的上一个位置开始的堆栈跟踪结束---

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at Microsoft.EntityFrameworkCore.Storage.Internal .SqlServerExecutionStrategy。< executeasync> d__7`2.MoveNext()

---从抛出异常的上一个位置开始的堆栈跟踪结束---

在System。 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotif的Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

ication(任务任务)

at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable`1.AsyncEnumerator。< movenext> d__11.MoveNext()

---结束从抛出异常的先前位置堆栈跟踪---

在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (任务任务)

at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()

at System.Linq.AsyncEnumerable。< firstordefault_> d__165`1 .MoveNext()

---从抛出异常的上一个位置开始的堆栈跟踪结束---

在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()<在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)上的


at Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider .TaskResultAsyncEnumerable`1.Enumerator。< movenext> d__3.MoveNext()

---从抛出异常的上一个位置开始的堆栈跟踪结束---

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)

在System.Runtime.CompilerServices.ConfiguredTaskAwaitable` 1.ConfiguredTaskAwaiter.GetResult()

在System.Linq.AsyncEnumerable.SelectEnumerableAsyncIterator`2。< movenextcore> d__7.MoveNext()

---堆栈跟踪结束从抛出异常的先前位置---

在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)

在System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()

在System.Linq.AsyncEnu merable.AsyncIterator`1。< movenext> d__10.MoveNext()

---从抛出异常的上一个位置开始的堆栈跟踪结束---

at System .Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)

在Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider .ExceptionInterceptor`1.EnumeratorExceptionInterceptor。< movenext> d__5.MoveNext()

---从抛出异常的上一个位置开始的堆栈跟踪结束---

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)

在Microsoft.EntityFrameworkCore.Query.Internal。 QueryCompiler。< execuingletonasyncquery> d__21`1.MoveNext()

---从前一个位置开始的堆栈跟踪,其中异常是thr System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)中拥有---



at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()

at contractme.Startup。< createmoderator> d__7.MoveNext()in C:\ Users\miche \\ \\ source \repos\contractme\contractme \Startup.cs:第118行

---内部异常堆栈跟踪结束---

在System。 Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)

at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout,CancellationToken cancellationToken)

at System.Threading.Tasks .Task.Wait()

at contractme.Startup.Configure(IApplicationBuilder app,IHostingEnvironment env,IServiceProvider serviceProvider)在C:\ Users \miche \ source \ times \ conttractme \ contractme\\ Startup.cs:第78行

在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw( )Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder应用程序)上的


at Microsoft.AspNetCore.Hosting.Internal.AutoRequestServicesStartupFilter。<> c__DisplayClass0_0。<配置> b__0(IApplicationBuilder构建器)

at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()

---> (内部异常#0)System.Data.SqlClient.SqlException(0x80131904):无效的列名'禁止'。

在System.Data.SqlClient.SqlCommand。<> c。< executedbdatareaderasync> ; b__108_0(任务`1结果)

在System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()

在System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback回调,对象状态)

在System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)

---来自先前位置的堆栈跟踪结束,其中异常是抛出---

在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)

at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand。< executeasync> d__17.MoveNext()

---来自先前位置的堆栈跟踪结束抛出异常---

在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)

at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable`1.AsyncEnumerator。< bufferlessmovenext> d__12.MoveNext()

---来自先前位置的堆栈跟踪结束被抛出---

在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)

at Microsoft.EntityFrameworkCore.Storage.Internal.SqlServerExecutionStrategy。< executeasync> d__7`2.MoveNext()

---从先前位置抛出异常的堆栈跟踪结束 - -

在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

在System.Runtime.CompilerServices.TaskAwaite r.HandleNonSuccessAndDebuggerNotification(任务任务)

at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable`1.AsyncEnumerator。< movenext> d__11.MoveNext()

---从抛出异常的先前位置开始的堆栈跟踪结束---在System.Runtime.CompilerServices.TaskAwaiter上的System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()


.HandleNonSuccessAndDebuggerNotification(任务任务)

在System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()

在System.Linq.AsyncEnumerable。< firstordefault_> d__165 `1.MoveNext()

---从抛出异常的上一个位置开始的堆栈跟踪结束---

在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw( )

在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)

在Microsoft.EntityFrameworkCore.Query。 Internal.AsyncLinqOperatorProvider.TaskResultAsyncEnumerable`1.Enumerator。< movenext> d__3.MoveNext()

---从抛出异常的上一个位置开始的堆栈跟踪结束---

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)

在System.Runtime.CompilerServices .ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()

在System.Linq.AsyncEnumerable.SelectEnumerableAsyncIterator`2。< movenextcore> d__7.MoveNext()

---结束抛出异常的先前位置的堆栈跟踪---在System.Runtime.CompilerServices.TaskAwaiter上的System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()


。 HandleNonSuccessAndDebuggerNotification(任务任务)

在System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
。< movenext> d__10.MoveNext()

---从抛出异常的上一个位置开始的堆栈跟踪结束 - -

在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)

at Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.ExceptionInterceptor`1.EnumeratorExceptionInterceptor。< movenext> d__5.MoveNext()

---从抛出异常的上一个位置开始的堆栈跟踪结束 - -

在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)

在Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler。< executingletonasyncquery> d__21`1.MoveNext()

---来自上一页的堆栈跟踪结束抛出异常的位置---

在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务) )

at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()

at contractme.Startup。< createmoderator> d__7.MoveNext()in C:\ Users\miche\source\repos\contractme\contractme \Startup.cs:第118行

ClientConnectionId:a12367ae-8fc6-4974-a289-7b7a4130cd92

错误号:207,状态:1,类:16< ---



失败:Microsoft.EntityFrameworkCore.Query [10100]

迭代上下文类型'contractme.Data.ApplicationDbContext'的查询结果时数据库发生异常。

System.Data.SqlClient.SqlException(0x80131904):无效的列名'禁止' 。

在System.Data.SqlClient.SqlCommand。<&g t; c。< executedbdatareaderasync> b__108_0(任务`1结果)

在System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()

在System.Threading。 ExecutionContext.Run(ExecutionContext executionContext,ContextCallback callback,Object state)

at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)

---从抛出异常的上一个位置开始的堆栈跟踪结束---

在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)

在Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand。< executeasync> d__17.MoveNext()

---从抛出异常的上一个位置开始的堆栈跟踪结束---

在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)

at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable`1.AsyncEnumerator。< bufferlessmovenext> d__12.MoveNext()

---从抛出异常的先前位置开始的堆栈跟踪结束---

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at Microsoft.EntityFrameworkCore.Storage.Internal .SqlServerExecutionStrategy。< executeasync> d__7`2.MoveNext()

---从抛出异常的上一个位置开始的堆栈跟踪结束---

在System。 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)上的
运行时.ExceptionServices.ExceptionDispatchInfo.Throw()

at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable` 1.AsyncEnumerator。< movenext> d__11.MoveNext()

---从抛出异常的上一个位置开始的堆栈跟踪结束---

在System.Runtime System.Runtime.CompilerServices上的.ExceptionServices.ExceptionDispatchInfo.Throw()

。 SystemAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)

at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()

at System.Linq.AsyncEnumerable。< firstordefault_> d__165`1.MoveNext()

---从抛出异常的上一个位置开始的堆栈跟踪结束---

在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw ()

在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)

at Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.TaskResultAsyncEnumerable`1.Enumerator。< ; movenext> d__3.MoveNext()

---从抛出异常的上一个位置开始的堆栈跟踪结束---

在System.Runtime.ExceptionServices.ExceptionDispatchInfo。在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAn中抛出()

dDebuggerNotification(任务任务)

at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()

at System.Linq.AsyncEnumerable.SelectEnumerableAsyncIterator`2。< movenextcore> d__7.MoveNext()

---从抛出异常的上一个位置开始的堆栈跟踪结束---

在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw ()

在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)

在System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
。< movenext> d__10.MoveNext()

---从抛出异常的上一个位置开始的堆栈跟踪结束 - -

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

at System.Runtime.Co mpilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.ExceptionInterceptor`1.EnumeratorExceptionInterceptor.<movenext>d__5.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.<executesingletonasyncquery>d__21`1.MoveNext()

ClientConnectionId:a12367ae-8fc6-4974-a289-7b7a4130cd92

Error Number:207,State:1,Class:16

System.Data.SqlClient.SqlException (0x80131904): Invalid column name ’Banned’.

at System.Data.SqlClient.SqlCommand.<>c.<executedbdatareaderasync> ;b__108_0(Task`1 result)

at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()

at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)

--- End of stack trace from previous location where exception was thrown ---

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.<executeasync>d__17.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable`1.AsyncEnumerator.<bufferlessmovenext>d__12.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

at System.Runtime.ExceptionServices.ExceptionDispatchIn fo.Throw()

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at Microsoft.EntityFrameworkCore.Storage.Internal.SqlServerExecutionStrategy.<executeasync>d__7`2.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable`1.AsyncEnumerator.<movenext>d__11.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at System.Runtime.CompilerServices.Co nfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()

at System.Linq.AsyncEnumerable.<firstordefault_>d__165`1.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.TaskResultAsyncEnumerable`1.Enumerator.<movenext>d__3.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()

at System.Li nq.AsyncEnumerable.SelectEnumerableAsyncIterator`2.<movenextcore>d__7.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()

at System.Linq.AsyncEnumerable.AsyncIterator`1.<movenext>d__10.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.ExceptionInterceptor`1.EnumeratorExceptionInterceptor.<move next>d__5.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.<executesingletonasyncquery>d__21`1.MoveNext()

ClientConnectionId:a12367ae-8fc6-4974-a289-7b7a4130cd92

Error Number:207,State:1,Class:16

crit: Microsoft.AspNetCore.Hosting.Internal.WebHost[6]

Application startup exception

System.AggregateException: One or more errors occurred. (Invalid column name ’Banned’.) ---> System.Data.SqlClient.SqlException: Invalid column name ’Banned’.

at System.Data.SqlClient.SqlCommand.<>c.<executedbdatareaderasync>b__108_0(Task`1 result)

at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()

at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)

--- End of stack trace from previous location where exception was thrown ---

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.<executeasync>d__17.MoveNext()

--- End of stack trace from previous location where exception was thrown ---
$b$ b at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable`1.AsyncEnumerator.<bufferlessmovenext>d__12.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at Microsoft.EntityFrameworkCore.Storage.Internal.SqlServerExecutionStrategy.<executeasync>d__7`2.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotif ication(Task task)

at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable`1.AsyncEnumerator.<movenext>d__11.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()

at System.Linq.AsyncEnumerable.<firstordefault_>d__165`1.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider .TaskResultAsyncEnumerable`1.Enumerator.<movenext>d__3.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()

at System.Linq.AsyncEnumerable.SelectEnumerableAsyncIterator`2.<movenextcore>d__7.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()

at System.Linq.AsyncEnu merable.AsyncIterator`1.<movenext>d__10.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.ExceptionInterceptor`1.EnumeratorExceptionInterceptor.<movenext>d__5.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.<executesingletonasyncquery>d__21`1.MoveNext()

--- End of stack trace from previous location where exception was thr own ---

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()

at contractme.Startup.<createmoderator>d__7.MoveNext() in C:\Users\miche\source\repos\contractme\contractme\Startup.cs:line 118

--- End of inner exception stack trace ---

at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)

at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)

at System.Threading.Tasks.Task.Wait()

at contractme.Startup.Configure(IApplicationBuilder app, IHostingEnvironment env, IServiceProvider serviceProvider) in C:\Users\miche\source\repos\contractme\contractme\ Startup.cs:line 78

--- End of stack trace from previous location where exception was thrown ---

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app)

at Microsoft.AspNetCore.Hosting.Internal.AutoRequestServicesStartupFilter.<>c__DisplayClass0_0.<configure>b__0(IApplicationBuilder builder)

at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()

---> (Inner Exception #0) System.Data.SqlClient.SqlException (0x80131904): Invalid column name ’Banned’.

at System.Data.SqlClient.SqlCommand.<>c.<executedbdatareaderasync>b__108_0(Task`1 result)

at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()

at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)

--- End of stack trace from previous location where exception was thrown ---

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.<executeasync>d__17.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable`1.AsyncEnumerator.<bufferlessmovenext>d__12.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at Microsoft.EntityFrameworkCore.Storage.Internal.SqlServerExecutionStrategy.<executeasync>d__7`2.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

at System.Runtime.CompilerServices.TaskAwaite r.HandleNonSuccessAndDebuggerNotification(Task task)

at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable`1.AsyncEnumerator.<movenext>d__11.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()

at System.Linq.AsyncEnumerable.<firstordefault_>d__165`1.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at Microsoft.EntityFrameworkCore.Query. Internal.AsyncLinqOperatorProvider.TaskResultAsyncEnumerable`1.Enumerator.<movenext>d__3.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()

at System.Linq.AsyncEnumerable.SelectEnumerableAsyncIterator`2.<movenextcore>d__7.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()

at System.Linq.AsyncEnumerable.AsyncIterator`1.<movenext>d__10.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.ExceptionInterceptor`1.EnumeratorExceptionInterceptor.<movenext>d__5.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.<executesingletonasyncquery>d__21`1.MoveNext()

--- End of stack trace from previou s location where exception was thrown ---

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()

at contractme.Startup.<createmoderator>d__7.MoveNext() in C:\Users\miche\source\repos\contractme\contractme\Startup.cs:line 118

ClientConnectionId:a12367ae-8fc6-4974-a289-7b7a4130cd92

Error Number:207,State:1,Class:16<---



An error occurred while accessing the IWebHost on class ’Program’. Continuing without the application service provider. Error: One or more errors occurred. (Invalid column name ’Banned’.)

Unable to create an object of type ’ApplicationDbContext’. Add an implementation of ’IDesignTimeDbContextFactory<applicationdbcontext>’ to the project, or see https://go.microsoft.com/fwlink/?linkid=851728 for additional patterns supported at design time.

PM>

PM> add-migration AddBannedToApplicationUser
Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0]
User profile is available. Using 'C:\Users\miche\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest.
Microsoft.EntityFrameworkCore.Infrastructure[10403]
Entity Framework Core 2.1.1-rtm-30846 initialized 'ApplicationDbContext' using provider 'Microsoft.EntityFrameworkCore.SqlServer' with options: None
Microsoft.EntityFrameworkCore.Database.Command[20101]
Executed DbCommand (61ms) [Parameters=[@__normalizedName_0='?' (Size = 256)], CommandType='Text', CommandTimeout='30']
SELECT TOP(1) [r].[Id], [r].[ConcurrencyStamp], [r].[Name], [r].[NormalizedName]
FROM [AspNetRoles] AS [r]
WHERE [r].[NormalizedName] = @__normalizedName_0
Microsoft.EntityFrameworkCore.Database.Command[20101]
Executed DbCommand (0ms) [Parameters=[@__normalizedName_0='?' (Size = 256)], CommandType='Text', CommandTimeout='30']
SELECT TOP(1) [r].[Id], [r].[ConcurrencyStamp], [r].[Name], [r].[NormalizedName]
FROM [AspNetRoles] AS [r]
WHERE [r].[NormalizedName] = @__normalizedName_0
fail: Microsoft.EntityFrameworkCore.Database.Command[20102]
Failed executing DbCommand (2ms) [Parameters=[@__normalizedEmail_0='?' (Size = 256)], CommandType='Text', CommandTimeout='30']
SELECT TOP(1) [u].[Id], [u].[AccessFailedCount], [u].[Banned], [u].[ConcurrencyStamp], [u].[Email], [u].[EmailConfirmed], [u].[FirstName], [u].[LastName], [u].[LockoutEnabled], [u].[LockoutEnd], [u].[NormalizedEmail], [u].[NormalizedUserName], [u].[PasswordHash], [u].[PhoneNumber], [u].[PhoneNumberConfirmed], [u].[RegistrationDate], [u].[SecurityStamp], [u].[TwoFactorEnabled], [u].[UserName]
FROM [AspNetUsers] AS [u]
WHERE [u].[NormalizedEmail] = @__normalizedEmail_0
System.Data.SqlClient.SqlException (0x80131904): Invalid column name 'Banned'.
at System.Data.SqlClient.SqlCommand.<>c.<executedbdatareaderasync>b__108_0(Task`1 result)
at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.<executeasync>d__17.MoveNext()
ClientConnectionId:a12367ae-8fc6-4974-a289-7b7a4130cd92
Error Number:207,State:1,Class:16
fail: Microsoft.EntityFrameworkCore.Query[10100]
An exception occurred in the database while iterating the results of a query for context type 'contractme.Data.ApplicationDbContext'.
System.Data.SqlClient.SqlException (0x80131904): Invalid column name 'Banned'.
at System.Data.SqlClient.SqlCommand.<>c.<executedbdatareaderasync>b__108_0(Task`1 result)
at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.<executeasync>d__17.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable`1.AsyncEnumerator.<bufferlessmovenext>d__12.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Storage.Internal.SqlServerExecutionStrategy.<executeasync>d__7`2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable`1.AsyncEnumerator.<movenext>d__11.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at System.Linq.AsyncEnumerable.<firstordefault_>d__165`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.TaskResultAsyncEnumerable`1.Enumerator.<movenext>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at System.Linq.AsyncEnumerable.SelectEnumerableAsyncIterator`2.<movenextcore>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at System.Linq.AsyncEnumerable.AsyncIterator`1.<movenext>d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.ExceptionInterceptor`1.EnumeratorExceptionInterceptor.<movenext>d__5.MoveNext()
ClientConnectionId:a12367ae-8fc6-4974-a289-7b7a4130cd92
Error Number:207,State:1,Class:16
System.Data.SqlClient.SqlException (0x80131904): Invalid column name 'Banned'.
at System.Data.SqlClient.SqlCommand.<>c.<executedbdatareaderasync>b__108_0(Task`1 result)
at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.<executeasync>d__17.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable`1.AsyncEnumerator.<bufferlessmovenext>d__12.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Storage.Internal.SqlServerExecutionStrategy.<executeasync>d__7`2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable`1.AsyncEnumerator.<movenext>d__11.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at System.Linq.AsyncEnumerable.<firstordefault_>d__165`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.TaskResultAsyncEnumerable`1.Enumerator.<movenext>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at System.Linq.AsyncEnumerable.SelectEnumerableAsyncIterator`2.<movenextcore>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at System.Linq.AsyncEnumerable.AsyncIterator`1.<movenext>d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.ExceptionInterceptor`1.EnumeratorExceptionInterceptor.<movenext>d__5.MoveNext()
ClientConnectionId:a12367ae-8fc6-4974-a289-7b7a4130cd92
Error Number:207,State:1,Class:16
Application startup exception: System.AggregateException: One or more errors occurred. (Invalid column name 'Banned'.) ---> System.Data.SqlClient.SqlException: Invalid column name 'Banned'.
at System.Data.SqlClient.SqlCommand.<>c.<executedbdatareaderasync>b__108_0(Task`1 result)
at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.<executeasync>d__17.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable`1.AsyncEnumerator.<bufferlessmovenext>d__12.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Storage.Internal.SqlServerExecutionStrategy.<executeasync>d__7`2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable`1.AsyncEnumerator.<movenext>d__11.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at System.Linq.AsyncEnumerable.<firstordefault_>d__165`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.TaskResultAsyncEnumerable`1.Enumerator.<movenext>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at System.Linq.AsyncEnumerable.SelectEnumerableAsyncIterator`2.<movenextcore>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at System.Linq.AsyncEnumerable.AsyncIterator`1.<movenext>d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.ExceptionInterceptor`1.EnumeratorExceptionInterceptor.<movenext>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.<executesingletonasyncquery>d__21`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at contractme.Startup.<createmoderator>d__7.MoveNext() in C:\Users\miche\source\repos\contractme\contractme\Startup.cs:line 118
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.Wait()
at contractme.Startup.Configure(IApplicationBuilder app, IHostingEnvironment env, IServiceProvider serviceProvider) in C:\Users\miche\source\repos\contractme\contractme\Startup.cs:line 78
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app)
at Microsoft.AspNetCore.Hosting.Internal.AutoRequestServicesStartupFilter.<>c__DisplayClass0_0.<configure>b__0(IApplicationBuilder builder)
at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
---> (Inner Exception #0) System.Data.SqlClient.SqlException (0x80131904): Invalid column name 'Banned'.
at System.Data.SqlClient.SqlCommand.<>c.<executedbdatareaderasync>b__108_0(Task`1 result)
at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.<executeasync>d__17.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable`1.AsyncEnumerator.<bufferlessmovenext>d__12.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Storage.Internal.SqlServerExecutionStrategy.<executeasync>d__7`2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable`1.AsyncEnumerator.<movenext>d__11.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at System.Linq.AsyncEnumerable.<firstordefault_>d__165`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.TaskResultAsyncEnumerable`1.Enumerator.<movenext>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at System.Linq.AsyncEnumerable.SelectEnumerableAsyncIterator`2.<movenextcore>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at System.Linq.AsyncEnumerable.AsyncIterator`1.<movenext>d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.ExceptionInterceptor`1.EnumeratorExceptionInterceptor.<movenext>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.<executesingletonasyncquery>d__21`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at contractme.Startup.<createmoderator>d__7.MoveNext() in C:\Users\miche\source\repos\contractme\contractme\Startup.cs:line 118
ClientConnectionId:a12367ae-8fc6-4974-a289-7b7a4130cd92
Error Number:207,State:1,Class:16<---

fail: Microsoft.EntityFrameworkCore.Query[10100]
An exception occurred in the database while iterating the results of a query for context type 'contractme.Data.ApplicationDbContext'.
System.Data.SqlClient.SqlException (0x80131904): Invalid column name 'Banned'.
at System.Data.SqlClient.SqlCommand.<>c.<executedbdatareaderasync>b__108_0(Task`1 result)
at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.<executeasync>d__17.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable`1.AsyncEnumerator.<bufferlessmovenext>d__12.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Storage.Internal.SqlServerExecutionStrategy.<executeasync>d__7`2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable`1.AsyncEnumerator.<movenext>d__11.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at System.Linq.AsyncEnumerable.<firstordefault_>d__165`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.TaskResultAsyncEnumerable`1.Enumerator.<movenext>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at System.Linq.AsyncEnumerable.SelectEnumerableAsyncIterator`2.<movenextcore>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at System.Linq.AsyncEnumerable.AsyncIterator`1.<movenext>d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.ExceptionInterceptor`1.EnumeratorExceptionInterceptor.<movenext>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.<executesingletonasyncquery>d__21`1.MoveNext()
ClientConnectionId:a12367ae-8fc6-4974-a289-7b7a4130cd92
Error Number:207,State:1,Class:16
System.Data.SqlClient.SqlException (0x80131904): Invalid column name 'Banned'.
at System.Data.SqlClient.SqlCommand.<>c.<executedbdatareaderasync>b__108_0(Task`1 result)
at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.<executeasync>d__17.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable`1.AsyncEnumerator.<bufferlessmovenext>d__12.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Storage.Internal.SqlServerExecutionStrategy.<executeasync>d__7`2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable`1.AsyncEnumerator.<movenext>d__11.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at System.Linq.AsyncEnumerable.<firstordefault_>d__165`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.TaskResultAsyncEnumerable`1.Enumerator.<movenext>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at System.Linq.AsyncEnumerable.SelectEnumerableAsyncIterator`2.<movenextcore>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at System.Linq.AsyncEnumerable.AsyncIterator`1.<movenext>d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.ExceptionInterceptor`1.EnumeratorExceptionInterceptor.<movenext>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.<executesingletonasyncquery>d__21`1.MoveNext()
ClientConnectionId:a12367ae-8fc6-4974-a289-7b7a4130cd92
Error Number:207,State:1,Class:16
crit: Microsoft.AspNetCore.Hosting.Internal.WebHost[6]
Application startup exception
System.AggregateException: One or more errors occurred. (Invalid column name 'Banned'.) ---> System.Data.SqlClient.SqlException: Invalid column name 'Banned'.
at System.Data.SqlClient.SqlCommand.<>c.<executedbdatareaderasync>b__108_0(Task`1 result)
at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.<executeasync>d__17.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable`1.AsyncEnumerator.<bufferlessmovenext>d__12.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Storage.Internal.SqlServerExecutionStrategy.<executeasync>d__7`2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable`1.AsyncEnumerator.<movenext>d__11.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at System.Linq.AsyncEnumerable.<firstordefault_>d__165`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.TaskResultAsyncEnumerable`1.Enumerator.<movenext>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at System.Linq.AsyncEnumerable.SelectEnumerableAsyncIterator`2.<movenextcore>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at System.Linq.AsyncEnumerable.AsyncIterator`1.<movenext>d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.ExceptionInterceptor`1.EnumeratorExceptionInterceptor.<movenext>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.<executesingletonasyncquery>d__21`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at contractme.Startup.<createmoderator>d__7.MoveNext() in C:\Users\miche\source\repos\contractme\contractme\Startup.cs:line 118
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.Wait()
at contractme.Startup.Configure(IApplicationBuilder app, IHostingEnvironment env, IServiceProvider serviceProvider) in C:\Users\miche\source\repos\contractme\contractme\Startup.cs:line 78
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app)
at Microsoft.AspNetCore.Hosting.Internal.AutoRequestServicesStartupFilter.<>c__DisplayClass0_0.<configure>b__0(IApplicationBuilder builder)
at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
---> (Inner Exception #0) System.Data.SqlClient.SqlException (0x80131904): Invalid column name 'Banned'.
at System.Data.SqlClient.SqlCommand.<>c.<executedbdatareaderasync>b__108_0(Task`1 result)
at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.<executeasync>d__17.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable`1.AsyncEnumerator.<bufferlessmovenext>d__12.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Storage.Internal.SqlServerExecutionStrategy.<executeasync>d__7`2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable`1.AsyncEnumerator.<movenext>d__11.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at System.Linq.AsyncEnumerable.<firstordefault_>d__165`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.TaskResultAsyncEnumerable`1.Enumerator.<movenext>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at System.Linq.AsyncEnumerable.SelectEnumerableAsyncIterator`2.<movenextcore>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at System.Linq.AsyncEnumerable.AsyncIterator`1.<movenext>d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.ExceptionInterceptor`1.EnumeratorExceptionInterceptor.<movenext>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.<executesingletonasyncquery>d__21`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at contractme.Startup.<createmoderator>d__7.MoveNext() in C:\Users\miche\source\repos\contractme\contractme\Startup.cs:line 118
ClientConnectionId:a12367ae-8fc6-4974-a289-7b7a4130cd92
Error Number:207,State:1,Class:16<---

An error occurred while accessing the IWebHost on class 'Program'. Continuing without the application service provider. Error: One or more errors occurred. (Invalid column name 'Banned'.)
Unable to create an object of type 'ApplicationDbContext'. Add an implementation of 'IDesignTimeDbContextFactory<applicationdbcontext>' to the project, or see https://go.microsoft.com/fwlink/?linkid=851728 for additional patterns supported at design time.
PM>





After the answer of Richard Deeming, now my code in the configure method is:





After the answer of Richard Deeming, now my code in the configure method is:

public void Configure(IApplicationBuilder app, IHostingEnvironment env, IServiceProvider serviceProvider, IApplicationLifetime applicationLifetime)
{
    if (env.IsDevelopment())
    {
        app.UseBrowserLink();
        app.UseDeveloperExceptionPage();
        app.UseDatabaseErrorPage();
    }
    else
    {
        app.UseStatusCodePagesWithReExecute("/Error/{0}");
    }

    app.UseStaticFiles();

    app.UseAuthentication();

    app.UseMvc(routes =>
    {
        routes.MapRoute(
            name: "default",
            template: "{controller=Home}/{action=Index}/{id?}");
    });

    applicationLifetime.ApplicationStarted.Register(new Action(() => InitializeApplication(serviceProvider)));
}





My InitializeApplication method code is:





My InitializeApplication method code is:

private void InitializeApplication(IServiceProvider serviceProvider)
{
    CreateRoles(serviceProvider).Wait();
    CreateModerator(serviceProvider).Wait();
}





And my CreateRoles method code is:





And my CreateRoles method code is:

private void CreateRoles(IServiceProvider serviceProvider)
{
    //Initialize role manager
    var roleManager = serviceProvider.GetRequiredService<RoleManager<IdentityRole>>();

    //We get if the moderator role already exists
    var moderatorRoleExists = roleManager.RoleExistsAsync(UserRoles.Moderator).Result;
    //We get if the user role already exists
    var userRoleExists = roleManager.RoleExistsAsync(UserRoles.User).Result;

    // if the moderator role doesn't exist
    if (!moderatorRoleExists)
    {
        //create the role and seed them to the database:
        var data = roleManager.CreateAsync(new IdentityRole(UserRoles.Moderator)).Result;
    }

    // if the moderator user doesn't exist
    if (!userRoleExists)
    {
        //create the role and seed them to the database:
        var data = roleManager.CreateAsync(new IdentityRole(UserRoles.User)).Result;
    }
}





The issue now, is the even though the first method inside InitializeApplication (CreateRoles) is being executed normally, the second method does not seem to get executed (Break point didn’t hit, and the expected database modification didn’t happen).



What I have tried:



I tried changing the name of the property, as well as the data type; nevertheless I got the same result. Additionally, I tried re-starting Visual Studio but once again, I got the same result.



The issue now, is the even though the first method inside InitializeApplication (CreateRoles) is being executed normally, the second method does not seem to get executed (Break point didn't hit, and the expected database modification didn't happen).

What I have tried:

I tried changing the name of the property, as well as the data type; nevertheless I got the same result. Additionally, I tried re-starting Visual Studio but once again, I got the same result.

推荐答案

Read: Unable to create an object of type ApplicationDbContext. Add an implementation of IDesignTimeDbContextFactory[^]


Looks like you’re trying to seed the data in the wrong place. You’re calling CreateModerator from your Configure method. That won’t work - the EF Core tools need to run that method in order to initialize the DbContext to discover what changes need to be added to the migration.



Microsoft’s recommendation is to use the HasData method from OnModelCreating:

Data Seeding - EF Core | Microsoft Docs[^]



Alternatively, you could hook into the application lifetime, and seed the data when the application is started:

asp.net core - Check conditions on startup - Stack Overflow[^]



Personally, I prefer to have the migrations in a separate console application, with any seed data added there. I don’t like the idea of a web application connecting to SQL as a user with permissions to create and alter databases.
Looks like you're trying to seed the data in the wrong place. You're calling CreateModerator from your Configure method. That won't work - the EF Core tools need to run that method in order to initialize the DbContext to discover what changes need to be added to the migration.

Microsoft's recommendation is to use the HasData method from OnModelCreating:
Data Seeding - EF Core | Microsoft Docs[^]

Alternatively, you could hook into the application lifetime, and seed the data when the application is started:
asp.net core - Check conditions on startup - Stack Overflow[^]

Personally, I prefer to have the migrations in a separate console application, with any seed data added there. I don't like the idea of a web application connecting to SQL as a user with permissions to create and alter databases.


这篇关于为applicationuser创建属性的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆