Asp.NET 身份核心 IsInRole InvalidOperationException:序列包含多个元素

Asp.NET Identity Core IsInRole InvalidOperationException: Sequence contains more than one element

我有这个代码:

...
var _context = new MyDbContext();     
var _userManager = new UserManager<User>(new UserStore<User>(_context));
...
public bool IsInRole(string userId, string roleName)
{
    return _userManager.IsInRole(userId, roleName); //InvalidOperationException
}

引发此异常:

An exception of type 'System.InvalidOperationException' occurred in mscorlib.dll but was not handled in user code

Additional information: Sequence contains more than one element

Visual Studio 2015

.NET 4.5

Microsoft AspNet 身份核心 2.2.1

Entity Framework 6

IdentityRoles 中有重复的名称table:

SELECT *
FROM [dbo].[IdentityRoles]

删除不需要的行解决了问题。