Why does a role shows as “not exist” even when present in the database (asp.net mvc)

前端 未结 1 581
鱼传尺愫
鱼传尺愫 2021-01-22 03:22

I\'m trying to add users to a role when registering a user so i seeded the roles and updated the database with the code below in the migrations.cs class

                 


        
相关标签:
1条回答
  • 2021-01-22 03:59

    The second parameter is the string role, as in "Reviewer" not the id of the role. It's erroring out because there is literally no role with Name equal to that GUID.

    See: https://msdn.microsoft.com/en-us/library/dn497483(v=vs.108).aspx

    0 讨论(0)
提交回复
热议问题