Open Closed

An error occurs when creating a user using the user module.when i depend AbpEventBusRabbitMqModule #8638


User avatar
0
327992883@qq.com created
  • ABP Framework version: v8.3.4

  • UI Type: Blazor Server

  • Database System: EF Core (SQL Server)

  • Tiered (for MVC) or Auth Server Separated (for Angular): yes

  • Exception message and full stack trace:

  • [19:07:20 INF] Executed endpoint 'Volo.Abp.Identity.IdentityUserController.CreateAsync (Volo.Abp.Identity.Pro.HttpApi)' [19:07:20 DBG] Added 0 entity changes to the current audit log [19:07:20 DBG] Remove dynamic claims cache for user: 36768f9d-2add-83c8-1692-3a1776abf25c [19:07:21 WRN] An exception occurred, but response has already started! [19:07:21 DBG] Added 0 entity changes to the current audit log [19:07:21 DBG] Added 0 entity changes to the current audit log [19:07:21 ERR] An unhandled exception has occurred while executing the request. RabbitMQ.Client.Exceptions.AlreadyClosedException: Already closed: The AMQP operation was interrupted: AMQP close-reason, initiated by Library, code=541, text='Unexpected Exception', classId=0, methodId=0, cause=System.Collections.Generic.KeyNotFoundException: The given key '3' was not present in the dictionary. at RabbitMQ.Client.Impl.SessionManager.Lookup(Int32 number) at RabbitMQ.Client.Framing.Impl.Connection.MainLoopIteration() at RabbitMQ.Client.Framing.Impl.Connection.MainLoop() at RabbitMQ.Client.Framing.Impl.Connection.EnsureIsOpen() at RabbitMQ.Client.Framing.Impl.AutorecoveringConnection.EnsureIsOpen() at RabbitMQ.Client.Framing.Impl.AutorecoveringConnection.CreateModel() at Volo.Abp.EventBus.RabbitMq.RabbitMqDistributedEventBus.PublishAsync(String eventName, Byte[] body, Dictionary2 headersArguments, Nullable1 eventId, String correlationId) at Volo.Abp.EventBus.RabbitMq.RabbitMqDistributedEventBus.PublishAsync(Type eventType, Object eventData, Dictionary2 headersArguments, Nullable1 eventId, String correlationId) at Volo.Abp.EventBus.RabbitMq.RabbitMqDistributedEventBus.PublishToEventBusAsync(Type eventType, Object eventData) at Volo.Abp.EventBus.Distributed.DistributedEventBusBase.PublishAsync(Type eventType, Object eventData, Boolean onUnitOfWorkComplete, Boolean useOutbox) at Volo.Abp.EventBus.UnitOfWorkEventPublisher.PublishDistributedEventsAsync(IEnumerable1 distributedEvents) at Volo.Abp.Uow.UnitOfWork.CompleteAsync(CancellationToken cancellationToken) at Volo.Abp.AspNetCore.Uow.AbpUnitOfWorkMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext() --- End of stack trace from previous location --- at Volo.Abp.AspNetCore.ExceptionHandling.AbpExceptionHandlingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) at Volo.Abp.AspNetCore.ExceptionHandling.AbpExceptionHandlingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext() --- End of stack trace from previous location --- at Volo.Abp.AspNetCore.Serilog.AbpSerilogMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext() --- End of stack trace from previous location --- at Volo.Abp.AspNetCore.Auditing.AbpAuditingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) at Volo.Abp.AspNetCore.Auditing.AbpAuditingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext() --- End of stack trace from previous location --- at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext) at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider) at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) at Volo.Abp.AspNetCore.MultiTenancy.MultiTenancyMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) at Volo.Abp.AspNetCore.Security.AbpSecurityHeadersMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.RequestLocalization.AbpRequestLocalizationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context) at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context) at Volo.Abp.AspNetCore.Mvc.Libs.AbpMvcLibsService.<CheckLibs>b__1_0(HttpContext httpContext, RequestDelegate next) at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context) at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context) at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication1 application) [19:07:21 WRN] The response has already started, the error page middleware will not be executed. [19:07:21 ERR] An unhandled exception has occurred while executing the request. RabbitMQ.Client.Exceptions.AlreadyClosedException: Already closed: The AMQP operation was interrupted: AMQP close-reason, initiated by Library, code=541, text='Unexpected Exception', classId=0, methodId=0, cause=System.Collections.Generic.KeyNotFoundException: The given key '3' was not present in the dictionary. at RabbitMQ.Client.Impl.SessionManager.Lookup(Int32 number) at RabbitMQ.Client.Framing.Impl.Connection.MainLoopIteration() at RabbitMQ.Client.Framing.Impl.Connection.MainLoop() at RabbitMQ.Client.Framing.Impl.Connection.EnsureIsOpen() at RabbitMQ.Client.Framing.Impl.AutorecoveringConnection.EnsureIsOpen() at RabbitMQ.Client.Framing.Impl.AutorecoveringConnection.CreateModel() at Volo.Abp.EventBus.RabbitMq.RabbitMqDistributedEventBus.PublishAsync(String eventName, Byte[] body, Dictionary2 headersArguments, Nullable1 eventId, String correlationId) at Volo.Abp.EventBus.RabbitMq.RabbitMqDistributedEventBus.PublishAsync(Type eventType, Object eventData, Dictionary2 headersArguments, Nullable1 eventId, String correlationId) at Volo.Abp.EventBus.RabbitMq.RabbitMqDistributedEventBus.PublishToEventBusAsync(Type eventType, Object eventData) at Volo.Abp.EventBus.Distributed.DistributedEventBusBase.PublishAsync(Type eventType, Object eventData, Boolean onUnitOfWorkComplete, Boolean useOutbox) at Volo.Abp.EventBus.UnitOfWorkEventPublisher.PublishDistributedEventsAsync(IEnumerable1 distributedEvents) at Volo.Abp.Uow.UnitOfWork.CompleteAsync(CancellationToken cancellationToken) at Volo.Abp.AspNetCore.Uow.AbpUnitOfWorkMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext() --- End of stack trace from previous location --- at Volo.Abp.AspNetCore.ExceptionHandling.AbpExceptionHandlingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) at Volo.Abp.AspNetCore.ExceptionHandling.AbpExceptionHandlingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext() --- End of stack trace from previous location --- at Volo.Abp.AspNetCore.Serilog.AbpSerilogMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext() --- End of stack trace from previous location --- at Volo.Abp.AspNetCore.Auditing.AbpAuditingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) at Volo.Abp.AspNetCore.Auditing.AbpAuditingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext() --- End of stack trace from previous location --- at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext) at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider) at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) at Volo.Abp.AspNetCore.MultiTenancy.MultiTenancyMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) at Volo.Abp.AspNetCore.Security.AbpSecurityHeadersMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.RequestLocalization.AbpRequestLocalizationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context) at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context) at Volo.Abp.AspNetCore.Mvc.Libs.AbpMvcLibsService.<CheckLibs>b__1_0(HttpContext httpContext, RequestDelegate next) at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context) at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context) at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication1 application) [19:07:21 WRN] The response has already started, the error page middleware will not be executed. [19:07:21 ERR] Connection id "0HN9KH7S7MPEQ", Request id "0HN9KH7S7MPEQ:00000002": An unhandled exception was thrown by the application. RabbitMQ.Client.Exceptions.AlreadyClosedException: Already closed: The AMQP operation was interrupted: AMQP close-reason, initiated by Library, code=541, text='Unexpected Exception', classId=0, methodId=0, cause=System.Collections.Generic.KeyNotFoundException: The given key '3' was not present in the dictionary. at RabbitMQ.Client.Impl.SessionManager.Lookup(Int32 number) at RabbitMQ.Client.Framing.Impl.Connection.MainLoopIteration() at RabbitMQ.Client.Framing.Impl.Connection.MainLoop() at RabbitMQ.Client.Framing.Impl.Connection.EnsureIsOpen() at RabbitMQ.Client.Framing.Impl.AutorecoveringConnection.EnsureIsOpen() at RabbitMQ.Client.Framing.Impl.AutorecoveringConnection.CreateModel() at Volo.Abp.EventBus.RabbitMq.RabbitMqDistributedEventBus.PublishAsync(String eventName, Byte[] body, Dictionary2 headersArguments, Nullable1 eventId, String correlationId) at Volo.Abp.EventBus.RabbitMq.RabbitMqDistributedEventBus.PublishAsync(Type eventType, Object eventData, Dictionary2 headersArguments, Nullable1 eventId, String correlationId) at Volo.Abp.EventBus.RabbitMq.RabbitMqDistributedEventBus.PublishToEventBusAsync(Type eventType, Object eventData) at Volo.Abp.EventBus.Distributed.DistributedEventBusBase.PublishAsync(Type eventType, Object eventData, Boolean onUnitOfWorkComplete, Boolean useOutbox) at Volo.Abp.EventBus.UnitOfWorkEventPublisher.PublishDistributedEventsAsync(IEnumerable`1 distributedEvents) at Volo.Abp.Uow.UnitOfWork.CompleteAsync(CancellationToken cancellationToken) at Volo.Abp.AspNetCore.Uow.AbpUnitOfWorkMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<

  • Steps to reproduce the issue:My project did not use AbpEventBusRabbitMqModule before. Recently, I added AbpEventBusRabbitMqModule. Then, an error will occur when creating a user. After removing AbpEventBusRabbitMqModule, creating a user can be successful. I don't know why adding AbpEventBusRabbitMqModule will affect the creation of users. What logic is there in the source code for creating users?


9 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Is your RabbitMQ server available?

    You can try using docker to create a Rabbitmq container

    docker run -d --name rabbitmq -p 5672:5672 -p 15672:15672 rabbitmq:4.0-management

    Update appsettings.json:

    {
      "RabbitMQ": {
        "EventBus": {
          "ClientName": "MyClientName",
          "ExchangeName": "MyExchangeName"
        }
      }
    }
    
  • User Avatar
    0
    327992883@qq.com created

    Hi,

    Is your RabbitMQ server available?

    You can try using docker to create a Rabbitmq container

    docker run -d --name rabbitmq -p 5672:5672 -p 15672:15672 rabbitmq:4.0-management

    Update appsettings.json:

    { 
      "RabbitMQ": { 
        "EventBus": { 
          "ClientName": "MyClientName", 
          "ExchangeName": "MyExchangeName" 
        } 
      } 
    } 
    

    Hi,distributed event bus works in-process by default, My project is not a microservices project,my rabbitmq is available,And I think rabbitmq should not be needed when creating a user.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    HI,

    If you don't need RabbitMQ distributed event bus, please remove AbpEventBusRabbitMqModule

  • User Avatar
    0
    327992883@qq.com created

    HI,

    If you don't need RabbitMQ distributed event bus, please remove AbpEventBusRabbitMqModule

    My rabbitmq needs to interact with other systems, so I need the rabbitmq module. Is there any other way? Or is my method incorrect?

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Can you describe your use case?

    distributed event bus works in-process by default, My project is not a microservices project

    When using AbpEventBusRabbitMqModule, it will be replaced with the RabbitMQ event bus.

  • User Avatar
    0
    327992883@qq.com created

    Can you describe your use case?

    distributed event bus works in-process by default, My project is not a microservices project

    When using AbpEventBusRabbitMqModule, it will be replaced with the RabbitMQ event bus.

    My system needs to produce and consume between it and other third-party systems. That's why I introduced that module. My project is just an ABP monolithic project, not a microservices project.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    other third-party systems

    This is not an ABP project, right?

    You can directly use the RabbitMQ class library https://www.nuget.org/packages/RabbitMQ.Client . instead of AbpEventBusRabbitMqModule

  • User Avatar
    0
    327992883@qq.com created

    other third-party systems

    This is not an ABP project, right?

    You can directly use the RabbitMQ class library https://www.nuget.org/packages/RabbitMQ.Client . instead of AbpEventBusRabbitMqModule

    other third-party systems This is an ABP project

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Can I check it remotely? you can contact me on WeChat.

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 May 15, 2025, 10:28