simpleidserver / SimpleIdServer

OpenID, OAuth 2.0, SCIM2.0, UMA2.0, FAPI, CIBA & OPENBANKING Framework for ASP.NET Core
https://simpleidserver.com/
Apache License 2.0
682 stars 90 forks source link

Having a postgresql problem? #746

Closed qq1176914912 closed 1 month ago

qq1176914912 commented 1 month ago

I'm sorry to bother you, but I have a question for you: I will publish your project as a file and deploy it to ubuntu, which also has postgresql installed. When the project starts, it will automatically create tables, which do not contain sequences: image When I save it to sql file(Select data and structure): image Then import the transferred file into another library, when the query is found to have a sequence: image When I accessed the deployed 5002 project using this imported database, the 5002 page did not appear when the login was complete, and an error occurred for the 5001 project:

5月 17 11:44:56 netiam dotnet-DataCenter[229613]: fail: Microsoft.AspNetCore.Server.Kestrel[13] 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: Connection id "0HN3M4ENPPOVE", Request id "0HN3M4ENPPOVE:0000002F": An unhandled exception was thrown by the application. 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: System.InvalidOperationException: The exception handler configured on ExceptionHandlerOptions produced a 404 status response. This InvalidOperationException containing the original exception was thrown since this is often due to a misconfigured ExceptionHandlingPath. If the exception handler is expected to return 404 status responses then set AllowStatusCode404Response to true. 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: ---> Microsoft.EntityFrameworkCore.DbUpdateException: An error occurred while saving the entity changes. See the inner exception for details. 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: ---> Npgsql.PostgresException (0x80004005): XX000: more than one owned sequence found 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: at Npgsql.Internal.NpgsqlConnector.ReadMessageLong(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage) 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder1.StateMachineBox1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken) 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: at Npgsql.NpgsqlCommand.ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken) 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken) 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: Exception data: 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: Severity: ERROR 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: SqlState: XX000 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: MessageText: more than one owned sequence found 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: File: pg_depend.c 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: Line: 880 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: Routine: getOwnedSequence 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: --- End of inner exception stack trace --- 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken) 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken) 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken) 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken) 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(IList1 entriesToSave, CancellationToken cancellationToken) 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(StateManager stateManager, Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken) 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: at Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.NpgsqlExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func4 operation, Func4 verifySucceeded, CancellationToken cancellationToken) 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken) 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken) 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: at SimpleIdServer.IdServer.UI.ConsentsController.Index(String prefix, ConfirmConsentsViewModel viewModel, CancellationToken cancellationToken) in D:\Aila\FW-IAM-Casbin\src\IdServer\SimpleIdServer.IdServer\UI\ConsentsController.cs:line 262 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.gAwaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask) 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context) 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.gAwaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.gAwaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context) 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.gLogged|17_1(ResourceInvoker invoker) 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.gLogged|17_1(ResourceInvoker invoker) 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: at Microsoft.AspNetCore.Routing.EndpointMiddleware.g__AwaitRequestTask|7_0(Endpoint endpoint, Task requestTask, ILogger logger) 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: at SimpleIdServer.IdServer.Swagger.SidSwaggerUIMiddleware.Invoke(HttpContext httpContext) in D:\Aila\FW-IAM-Casbin\src\IdServer\SimpleIdServer.IdServer.Swagger\SIDSwaggerUIMiddleware.cs:line 81 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: at SimpleIdServer.IdServer.Swagger.SIDSwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider) in D:\Aila\FW-IAM-Casbin\src\IdServer\SimpleIdServer.IdServer.Swagger\SIDSwaggerMiddleware.cs:line 37 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: at SimpleIdServer.IdServer.Middlewares.MtlsAuthenticationMiddleware.InvokeAsync(HttpContext context) in D:\Aila\FW-IAM-Casbin\src\IdServer\SimpleIdServer.IdServer\Middlewares\MtlsAuthenticationMiddleware.cs:line 44 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: at SimpleIdServer.IdServer.Middlewares.LanguageMiddleware.InvokeAsync(HttpContext context) in D:\Aila\FW-IAM-Casbin\src\IdServer\SimpleIdServer.IdServer\Middlewares\LanguageMiddleware.cs:line 28 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: at SimpleIdServer.IdServer.Middlewares.RealmMiddleware.InvokeAsync(HttpContext context) in D:\Aila\FW-IAM-Casbin\src\IdServer\SimpleIdServer.IdServer\Middlewares\RealmMiddleware.cs:line 62 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddlewareImpl.gAwaited|10_0(ExceptionHandlerMiddlewareImpl middleware, HttpContext context, Task task) 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: --- End of inner exception stack trace --- 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddlewareImpl.HandleException(HttpContext context, ExceptionDispatchInfo edi) 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddlewareImpl.g__Awaited|10_0(ExceptionHandlerMiddlewareImpl middleware, HttpContext context, Task task) 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context) 5月 17 11:44:56 netiam dotnet-DataCenter[229613]: at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)

I also tested my local computer and I found that my local computer did not have this problem. ubuntu postgresql version: psql (PostgreSQL) 12.18 (Ubuntu 12.18-0Ubuntu0.20.04.1)(It should be the latest version) The local version is PostgreSQL 16.1 Do you know how to deal with this problem, because you can't use the library automatically generated by the project every time.

simpleidserver commented 1 month ago

I tried to reproduce the problem on my local machine without success. The SimpleIdServer project is working on the migration libraries or the backup of the database. If you are working with a backup, please comment out the 'SeedData' function.