我有2个应用程序:
ManagementStudio和DocumentStudio。 ManagementStudio由DocumentStudio引用的几个dll组成。
当我尝试登录DocumentStudio时,出现此错误:
我不确定发生了什么事情,因为我已经在模型列表中包括了IdentityUserClaim:
[Table("IdentityUserClaim", Schema = "ManagementStudio")]
public class UserClaims : IdentityUserClaim<string>
{
[Key]
public override int Id { get; set; }
}
public DbSet<ApplicationUsers> ApplicationUsers { get; set; }
public DbSet<UserRoles> UserRoles { get; set; }
public DbSet<UserClaims> UserClaims { get; set; }
public DbSet<IdentityUserClaim<string>> IdentityUserClaim { get; set; }
public DbSet<IdentityUserRole<string>> IdentityUserRole { get; set; }
public DbSet<Applications> Applications { get; set; }
public DbSet<Roles> Roles { get; set; }
public DbSet<ApiAccess> ApiAccess { get; set; }
public DbSet<EventLogs> EventLogs { get; set; }
public DbSet<ActivityLogs> ActivityLogs { get; set; }
public DbSet<CommunicationLogs> CommunicationLogs { get; set; }
public DbSet<UploadLogs> UploadLogs { get; set; }
public DbSet<Repositories> Repositories { get; set; }
public DbSet<Emails> Emails { get; set; }
public DbSet<Assets> Assets { get; set; }
public DbSet<Announcements> Announcements { get; set; }
public DbSet<AnnouncementAttachments> AnnouncementAttachments { get; set; }
我还能做些什么来做这项工作?
编辑:
我注意到我的CustomClaimsHelper正在被调用,所以我也将其包括在内:
public class CustomClaimsCookieSignInHelper<TIdentityUser> where TIdentityUser : IdentityUser
{
private readonly SignInManager<TIdentityUser> _signInManager;
public CustomClaimsCookieSignInHelper(SignInManager<TIdentityUser> signInManager)
{
_signInManager = signInManager;
}
public async Task SignInUserAsync(TIdentityUser user, bool isPersistent, IEnumerable<Claim> customClaims)
{
var claimsPrincipal = await _signInManager.CreateUserPrincipalAsync(user);
var identity = claimsPrincipal.Identity as ClaimsIdentity;
var claims = (from c in claimsPrincipal.Claims select c).ToList();
var savedClaims = claims;
if (customClaims != null)
{
identity.AddClaims(customClaims);
}
await _signInManager.Context.SignInAsync(IdentityConstants.ApplicationScheme,
claimsPrincipal,
new AuthenticationProperties { IsPersistent = isPersistent });
}
}
编辑:
我已经测试过手动创建一个名为IdentityUserClaim的表,该表具有与ManagementStudio.IdentityUserClaim表相同的列,并且可以正常工作。这意味着,如果我删除IdentityUserClaim的架构,则该应用程序将运行。但是,有没有一种方法可以迫使DocumentStudio寻找合适的模式?