Open Closed

System.ObjectDisposedException #837


User avatar
0
meliksah created

Hi,

We migrated to PostgreSql(v 12.0) from Ms Sql. Right after login action we have below error. I checked recent posts but couldn't find similar issue. Could you help me please?

  • ABP Framework version: v4.0.0
  • UI type: Angular / MVC
  • DB provider: EF Core / PostgreSql 12.0
  • Tiered (MVC) or Identity Server Seperated (Angular): no
[00:38:58 INF] Request starting HTTP/2 OPTIONS https://localhost:44313/.well-known/openid-configuration - -
[00:38:58 INF] CORS policy execution successful.
[00:38:58 INF] Request finished HTTP/2 OPTIONS https://localhost:44313/.well-known/openid-configuration - - - 204 - - 0.9575ms
[00:38:58 INF] Request starting HTTP/2 GET https://localhost:44313/.well-known/openid-configuration - -
[00:38:58 INF] CORS policy execution successful.
[00:38:58 DBG] CORS request made for path: /.well-known/openid-configuration from origin: http://localhost:4200
[00:38:58 DBG] CorsPolicyService allowed origin: http://localhost:4200
[00:38:58 INF] CORS policy execution successful.
[00:38:58 DBG] Request path /.well-known/openid-configuration matched to endpoint type Discovery
[00:38:58 DBG] Endpoint enabled: Discovery, successfully created handler: IdentityServer4.Endpoints.DiscoveryEndpoint
[00:38:58 INF] Invoking IdentityServer endpoint: IdentityServer4.Endpoints.DiscoveryEndpoint for /.well-known/openid-configuration
[00:38:58 DBG] Start discovery request
[00:38:58 INF] Request finished HTTP/2 GET https://localhost:44313/.well-known/openid-configuration - - - 200 - application/json;+charset=UTF-8 274.6857ms
[00:38:58 INF] Request starting HTTP/2 OPTIONS https://localhost:44313/.well-known/openid-configuration/jwks - -
[00:38:58 INF] CORS policy execution successful.
[00:38:58 INF] Request finished HTTP/2 OPTIONS https://localhost:44313/.well-known/openid-configuration/jwks - - - 204 - - 0.7712ms
[00:38:58 INF] Request starting HTTP/2 GET https://localhost:44313/.well-known/openid-configuration/jwks - -
[00:38:58 INF] CORS policy execution successful.
[00:38:59 DBG] CORS request made for path: /.well-known/openid-configuration/jwks from origin: http://localhost:4200
[00:38:59 DBG] CorsPolicyService allowed origin: http://localhost:4200
[00:38:59 INF] CORS policy execution successful.
[00:38:59 DBG] Request path /.well-known/openid-configuration/jwks matched to endpoint type Discovery
[00:38:59 DBG] Endpoint enabled: Discovery, successfully created handler: IdentityServer4.Endpoints.DiscoveryKeyEndpoint
[00:38:59 INF] Invoking IdentityServer endpoint: IdentityServer4.Endpoints.DiscoveryKeyEndpoint for /.well-known/openid-configuration/jwks
[00:38:59 DBG] Start key discovery request
[00:38:59 INF] Request finished HTTP/2 GET https://localhost:44313/.well-known/openid-configuration/jwks - - - 200 - application/json;+charset=UTF-8 60.2183ms
[00:38:59 INF] Request starting HTTP/2 OPTIONS https://localhost:44313/api/abp/application-configuration - -
[00:38:59 INF] CORS policy execution successful.
[00:38:59 INF] Request finished HTTP/2 OPTIONS https://localhost:44313/api/abp/application-configuration - - - 204 - - 1.7764ms
[00:38:59 INF] Request starting HTTP/2 GET https://localhost:44313/api/abp/application-configuration - -
[00:38:59 INF] CORS policy execution successful.
[00:38:59 DBG] CORS request made for path: /api/abp/application-configuration from origin: http://localhost:4200 but was ignored because path was not for an allowed IdentityServer CORS endpoint
[00:38:59 INF] No CORS policy found for the specified request.
[00:38:59 INF] Executing endpoint 'Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationController.GetAsync (Volo.Abp.AspNetCore.Mvc)'
[00:38:59 INF] Route matched with {area = "abp", action = "Get", controller = "AbpApplicationConfiguration", page = ""}. Executing controller action with signature System.Threading.Tasks.Task`1[Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationConfigurationDto] GetAsync() on controller Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationController (Volo.Abp.AspNetCore.Mvc).
[00:38:59 DBG] Executing AbpApplicationConfigurationAppService.GetAsync()...
[00:38:59 DBG] Executed AbpApplicationConfigurationAppService.GetAsync().
[00:38:59 INF] Executing ObjectResult, writing value of type 'Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationConfigurationDto'.
[00:38:59 INF] Executed action Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationController.GetAsync (Volo.Abp.AspNetCore.Mvc) in 262.8591ms
[00:38:59 INF] Executed endpoint 'Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationController.GetAsync (Volo.Abp.AspNetCore.Mvc)'
[00:38:59 INF] Request finished HTTP/2 GET https://localhost:44313/api/abp/application-configuration - - - 200 - application/json;+charset=utf-8 326.1312ms
[00:39:03 INF] Request starting HTTP/2 GET https://localhost:44313/connect/authorize?response_type=code&client_id=******_App&state=c3JZcXhlNWFXRmpmQ1FjNEtrUkhoUFdkT3lXanF0aDFtSWxPdFZ1Y35rS2pn&redirect_uri=http%3A%2F%2Flocalhost%3A4200&scope=openid%20offline_access%******&code_challenge=zFFCoC_GVfeJ6Acg01P9v3B_RR__SzGrEnc76Zz8rAk&code_challenge_method=S256&nonce=c3JZcXhlNWFXRmpmQ1FjNEtrUkhoUFdkT3lXanF0aDFtSWxPdFZ1Y35rS2pn - -
[00:39:03 DBG] Request path /connect/authorize matched to endpoint type Authorize
[00:39:03 DBG] Endpoint enabled: Authorize, successfully created handler: IdentityServer4.Endpoints.AuthorizeEndpoint
[00:39:03 INF] Invoking IdentityServer endpoint: IdentityServer4.Endpoints.AuthorizeEndpoint for /connect/authorize
[00:39:03 DBG] Start authorize request
[00:39:03 DBG] User in authorize request: 03d8b7d1-7356-8f2b-8871-39f5ea699ea2
[00:39:03 DBG] Start authorize request protocol validation
[00:39:03 DBG] Batch acquisition of 1 triggers
[00:39:03 DBG] Calling Execute on job DEFAULT.Volo.Abp.BackgroundJobs.BackgroundJobWorker
[00:39:03 DBG] Trigger instruction : NoInstruction
[00:39:03 DBG] client configuration validation for client *******_App succeeded.
[00:39:03 DBG] Checking for PKCE parameters
[00:39:03 DBG] Calling into custom validator: IdentityServer4.Validation.DefaultCustomAuthorizeRequestValidator
[00:39:03 DBG] ValidatedAuthorizeRequest
{"ClientId":"HrI*******nOne_App","ClientName":"*****_App","RedirectUri":"http://localhost:4200","AllowedRedirectUris":["http://localhost:4200","https://**************etest.azurewebsites.net"],"SubjectId":"03d8b7d1-7356-8f2b-8871-39f5ea699ea2","ResponseType":"code","ResponseMode":"query","GrantType":"authorization_code","RequestedScopes":"openid offline_access *******","State":"c3JZcXhlNWFXRmpmQ1FjNEtrUkhoUFdkT3lXanF0aDFtSWxPdFZ1Y35rS2pn","UiLocales":null,"Nonce":"c3JZcXhlNWFXRmpmQ1FjNEtrUkhoUFdkT3lXanF0aDFtSWxPdFZ1Y35rS2pn","AuthenticationContextReferenceClasses":null,"DisplayMode":null,"PromptMode":"","MaxAge":null,"LoginHint":null,"SessionId":"3966E76C2DB7D69F37920B5AEE970152","Raw":{"response_type":"code","client_id":"*******","state":"c3JZcXhlNWFXRmpmQ1FjNEtrUkhoUFdkT3lXanF0aDFtSWxPdFZ1Y35rS2pn","redirect_uri":"http://localhost:4200","scope":"openid offline_access *******","code_challenge":"zFFCoC_GVfeJ6Acg01P9v3B_RR__SzGrEnc76Zz8rAk","code_challenge_method":"S256","nonce":"c3JZcXhlNWFXRmpmQ1FjNEtrUkhoUFdkT3lXanF0aDFtSWxPdFZ1Y35rS2pn"},"$type":"AuthorizeRequestValidationLog"}
[00:39:03 DBG] Client is configured to not require consent, no consent is required
[00:39:03 DBG] Creating Authorization Code Flow response.
[00:39:08 DBG] Batch acquisition of 1 triggers
[00:39:08 DBG] Calling Execute on job DEFAULT.Volo.Abp.BackgroundJobs.BackgroundJobWorker
[00:39:08 DBG] Trigger instruction : NoInstruction
[00:39:13 DBG] Batch acquisition of 1 triggers
[00:39:13 DBG] Calling Execute on job DEFAULT.Volo.Abp.BackgroundJobs.BackgroundJobWorker
[00:39:13 DBG] Trigger instruction : NoInstruction
[00:39:15 DBG] Batch acquisition of 1 triggers
[00:39:15 DBG] Calling Execute on job DEFAULT.NotificationWorkerQuartz
[00:39:15 DBG] Trigger instruction : NoInstruction
[00:39:18 DBG] Batch acquisition of 1 triggers
[00:39:18 DBG] Calling Execute on job DEFAULT.Volo.Abp.BackgroundJobs.BackgroundJobWorker
[00:39:18 DBG] Trigger instruction : NoInstruction
[00:39:22 ERR] An error occurred using a transaction.
[00:39:22 ERR] An error occurred using a transaction.
[00:39:22 FTL] Unhandled exception: Cannot access a disposed object.
Object name: 'NpgsqlTransaction'.
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'NpgsqlTransaction'.
   at Npgsql.NpgsqlTransaction.CheckDisposed()
   at Npgsql.NpgsqlTransaction.CheckReady()
   at Npgsql.NpgsqlTransaction.Commit(Boolean async, CancellationToken cancellationToken)
   at Npgsql.NpgsqlTransaction.Commit()
   at Microsoft.EntityFrameworkCore.Storage.RelationalTransaction.Commit()
   at Volo.Abp.Uow.EntityFrameworkCore.EfCoreTransactionApi.Commit()
   at Volo.Abp.Uow.EntityFrameworkCore.EfCoreTransactionApi.CommitAsync()
   at Volo.Abp.Uow.UnitOfWork.CommitTransactionsAsync()
   at Volo.Abp.Uow.UnitOfWork.CompleteAsync(CancellationToken cancellationToken)
   at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
   at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
   at Volo.Abp.IdentityServer.Grants.PersistedGrantStore.StoreAsync(PersistedGrant grant)
   at IdentityServer4.Stores.DefaultGrantStore`1.StoreItemAsync(String key, T item, String clientId, String subjectId, String sessionId, String description, DateTime created, Nullable`1 expiration, Nullable`1 consumedTime)
   at IdentityServer4.Stores.DefaultGrantStore`1.CreateItemAsync(T item, String clientId, String subjectId, String sessionId, String description, DateTime created, Int32 lifetime)
   at IdentityServer4.ResponseHandling.AuthorizeResponseGenerator.CreateCodeFlowResponseAsync(ValidatedAuthorizeRequest request)
   at IdentityServer4.ResponseHandling.AuthorizeResponseGenerator.CreateResponseAsync(ValidatedAuthorizeRequest request)
   at IdentityServer4.Endpoints.AuthorizeEndpointBase.ProcessAuthorizeRequestAsync(NameValueCollection parameters, ClaimsPrincipal user, ConsentResponse consent)
   at IdentityServer4.Endpoints.AuthorizeEndpoint.ProcessAsync(HttpContext context)
   at IdentityServer4.Hosting.IdentityServerMiddleware.Invoke(HttpContext context, IEndpointRouter router, IUserSession session, IEventService events, IBackChannelLogoutService backChannelLogoutService)
[00:39:22 ERR] An unhandled exception has occurred while executing the request.
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'NpgsqlTransaction'.
   at Npgsql.NpgsqlTransaction.CheckDisposed()
   at Npgsql.NpgsqlTransaction.CheckReady()
   at Npgsql.NpgsqlTransaction.Commit(Boolean async, CancellationToken cancellationToken)
   at Npgsql.NpgsqlTransaction.Commit()
   at Microsoft.EntityFrameworkCore.Storage.RelationalTransaction.Commit()
   at Volo.Abp.Uow.EntityFrameworkCore.EfCoreTransactionApi.Commit()
   at Volo.Abp.Uow.EntityFrameworkCore.EfCoreTransactionApi.CommitAsync()
   at Volo.Abp.Uow.UnitOfWork.CommitTransactionsAsync()
   at Volo.Abp.Uow.UnitOfWork.CompleteAsync(CancellationToken cancellationToken)
   at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
   at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
   at Volo.Abp.IdentityServer.Grants.PersistedGrantStore.StoreAsync(PersistedGrant grant)
   at IdentityServer4.Stores.DefaultGrantStore`1.StoreItemAsync(String key, T item, String clientId, String subjectId, String sessionId, String description, DateTime created, Nullable`1 expiration, Nullable`1 consumedTime)
   at IdentityServer4.Stores.DefaultGrantStore`1.CreateItemAsync(T item, String clientId, String subjectId, String sessionId, String description, DateTime created, Int32 lifetime)
   at IdentityServer4.ResponseHandling.AuthorizeResponseGenerator.CreateCodeFlowResponseAsync(ValidatedAuthorizeRequest request)
   at IdentityServer4.ResponseHandling.AuthorizeResponseGenerator.CreateResponseAsync(ValidatedAuthorizeRequest request)
   at IdentityServer4.Endpoints.AuthorizeEndpointBase.ProcessAuthorizeRequestAsync(NameValueCollection parameters, ClaimsPrincipal user, ConsentResponse consent)
   at IdentityServer4.Endpoints.AuthorizeEndpoint.ProcessAsync(HttpContext context)
   at IdentityServer4.Hosting.IdentityServerMiddleware.Invoke(HttpContext context, IEndpointRouter router, IUserSession session, IEventService events, IBackChannelLogoutService backChannelLogoutService)
   at IdentityServer4.Hosting.IdentityServerMiddleware.Invoke(HttpContext context, IEndpointRouter router, IUserSession session, IEventService events, IBackChannelLogoutService backChannelLogoutService)
   at IdentityServer4.Hosting.MutualTlsEndpointMiddleware.Invoke(HttpContext context, IAuthenticationSchemeProvider schemes)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at IdentityServer4.Hosting.BaseUrlMiddleware.Invoke(HttpContext context)
   at Volo.Abp.AspNetCore.MultiTenancy.MultiTenancyMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Builder.ApplicationBuilderAbpJwtTokenMiddlewareExtension.<>c__DisplayClass0_0.<<UseJwtTokenMiddleware>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.RequestLocalization.AbpRequestLocalizationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
[00:39:22 INF] Request finished HTTP/2 GET https://localhost:44313/connect/authorize?response_type=code&client_id=*******&state=c3JZcXhlNWFXRmpmQ1FjNEtrUkhoUFdkT3lXanF0aDFtSWxPdFZ1Y35rS2pn&redirect_uri=http%3A%2F%2Flocalhost%3A4200&scope=openid%20offline_access%20_____&code_challenge=zFFCoC_GVfeJ6Acg01P9v3B_RR__SzGrEnc76Zz8rAk&code_challenge_method=S256&nonce=c3JZcXhlNWFXRmpmQ1FjNEtrUkhoUFdkT3lXanF0aDFtSWxPdFZ1Y35rS2pn - - - 500 - text/html;+charset=utf-8 19663.0314ms
[00:39:23 DBG] Batch acquisition of 1 triggers

2 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Can you try to use the latest pakcage of Npgsql.EntityFrameworkCore.PostgreSQL

    <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="5.0.2" />
    
  • User Avatar
    0
    meliksah created

    Thanks maliming,

       Now it is working.
    
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v9.3.0-preview. Updated on June 13, 2025, 11:37