oqtane.framework: [BUG] 5.2.3: Unable to Install Oqtane On Windows IIS

Oqtane Info

Version - 5.2.3 Render Mode - Static Interactivity - Server Database - SQL Server or LocalDB Web Server - Standalone Production IIS Server (no control panel such as plesk)

Describe the bug

https://github.com/oqtane/oqtane.framework/discussions/4665 Unable to Install Oqtane On Windows IIS (have not tested via Linux/Apache)

Steps To Reproduce

Attempt to Install Oqtane using LocalDB OR MS SQL (With database already created) using IIS Express or IIS.

Anything else?

https://learn.microsoft.com/en-us/ef/core/dbcontext-configuration/#avoiding-dbcontext-threading-issues

Error: An Error Occurred Creating Site. System.InvalidOperationException: A second operation was started on this context instance before a previous operation completed. This is usually caused by different threads concurrently using the same instance of DbContext. For more information on how to avoid threading issues with DbContext, see https://go.microsoft.com/fwlink/?linkid=2097913. at Microsoft.EntityFrameworkCore.Infrastructure.Internal.ConcurrencyDetector.EnterCriticalSection() at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable1.AsyncEnumerator.MoveNextAsync() at Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.SingleOrDefaultAsync[TSource](IAsyncEnumerable1 asyncEnumerable, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.SingleOrDefaultAsync[TSource](IAsyncEnumerable1 asyncEnumerable, CancellationToken cancellationToken) at Microsoft.AspNetCore.Identity.UserManager1.FindByNameAsync(String userName) at Oqtane.Repository.UserRoleRepository.UpdateSecurityStamp(Int32 userId) in C:\Source\Projects\oqtane.framework\Oqtane.Server\Repository\UserRoleRepository.cs:line 168 at Oqtane.Repository.UserRoleRepository.AddUserRole(UserRole userRole) in C:\Source\Projects\oqtane.framework\Oqtane.Server\Repository\UserRoleRepository.cs:line 75 at Oqtane.Infrastructure.DatabaseManager.CreateSite(InstallConfig install) in C:\Source\Projects\oqtane.framework\Oqtane.Server\Infrastructure\DatabaseManager.cs:line 592

this specific scenario (ie. creating a new site in a multi-tenant environment using an isolated database) may have been affected by the recent enhancements in 5.2.2 to support SecurityStamp:

Oqtane.Repository.UserRoleRepository.UpdateSecurityStamp(Int32 userId) in C:\Source\Projects\oqtane.framework\Oqtane.Server\Repository\UserRoleRepository.cs:line 168

This method relies on the .NET Identity library - which appears to be throwing the DbContext exception. Perhaps the .NET Identity library is not using DbContextFactory (which is the recommended approach in Blazor). This will require more investigation.

Upgraded from 5.0.1 successfully. Lost the login and dashboard controls/button, gained search feature as an FYI default template.

Additional sites also cannot be created with new databases from within an existing Oqtane instance.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 24 (19 by maintainers)

Commits related to this issue

Most upvoted comments

I was able to reproduce the error using IIS and LocalDB. I have a resolution but I want to validate a number of other scenarios before I submit the PR.