.NET Core Database Operation Failed when logging in RRS feed

  • Question

  • User297458589 posted

    I have 2 applications:

    1. ManagementStudio
    2. DocumentStudio

    DocumentStudio references ManagementStudio dlls. The account management function is located in ManagementStudio so if I want to login from DocumentStudio, its tied to one of the dlls within ManagementStudio.

    Right now, this is the error I get when I try to login from DocumentStudio:

    enter image description here

    Previously I have already run all migrations for ManagementStudio. However, I discovered that if I go back and add another migration, I'll suddenly have a bunch of Delete Data and Insert Data's of the same thing. As in, the data deleted and entered are the same.

    When I perform the migration and update the database, the same error happens. I am unsure of how to solve this issue.

    The structure of my database is like this:

    There are 2 schemas. ManagementStudio.[Name] and DocumentStudio.[Name]

    Tuesday, June 25, 2019 2:26 AM

All replies

  • User-1764593085 posted

    Hi StardocsSVC,

    Not clear about the two application, how do you login from DocumentStudio?

    Do you have a  `ApplicationUsers`  table in your database?

    What do your dbcontext and csproj file look like? Could you share image of your structure and tell us how to reproduce this problem if it is possible?

    Tuesday, June 25, 2019 5:50 AM
  • User297458589 posted

    Hi Xing,

    DocumentStudio has its own login screen. But it references the login functions from ManagementStudio which connects to the ApplicationUsers table in the database.

    The DocumentStudio login declares 

    SignInManager<ApplicationUsers> signInManager

    ApplicationUsers is referenced from ManagementStudio. In order to login, I use this:

    var result = await _signInManager.PasswordSignInAsync(Input.UserName, Input.Password, Input.RememberMe, lockoutOnFailure: true);

    This is what ManagementStudios DbContext looks like:

    public ManagementStudioDbContext(DbContextOptions<ManagementStudioDbContext> options) : base(options)
    public DbSet<ApplicationUsers> ApplicationUsers { get; set; }
    public DbSet<UserRoles> UserRoles { get; set; }

    This is what DocumentStudios DbContext looks like:

    public DocumentStudioDbContext(DbContextOptions<DocumentStudioDbContext> options) : base(options) { }
    public DbSet<Documents> Documents { get; set; }
    public DbSet<DocumentCategories> DocumentCategories { get; set; }
    public DbSet<DocumentFields> DocumentFields { get; set; }

    This is DocumentStudios .csproj (The section which refers to ManagementStudio)

        <Reference Include="ManagementStudio">
        <Reference Include="ManagementStudio.Analytics">
        <Reference Include="ManagementStudio.ClassLibrary">
        <Reference Include="ManagementStudio.Connect">
        <Reference Include="ManagementStudio.Data">
        <Reference Include="ManagementStudio.Repository">

    This is the connectionstring in DocumentStudios Startup.cs

    services.AddDbContext<DocumentStudioDbContext>(options => options.UseSqlServer(Environment.GetEnvironmentVariable(DSCASGlobals.DS_ConnectionString)));
    services.AddDbContext<ManagementStudioDbContext>(options => options.UseSqlServer(Environment.GetEnvironmentVariable(DSCASGlobals.DS_ConnectionString)));

    Tuesday, June 25, 2019 7:13 AM
  • User-1764593085 posted

    Hi StardocsSVC,

    I am glad that you have resolved the migration error from the so post,is it yours?


    I realized what the previous image meant. When I recompiled and deleted and remigrated to my database, i forgot to push the new dlls to DocumentStudio. When I did that, it solved the migration versioning issue. 

    I also notice that you post another thread for following problem, you could mark the helpful answer or share your solution to close this thread now.

    Best Regards,


    Wednesday, June 26, 2019 3:24 AM