Activities of "liangshiwei"

Hi,

Can you try updating routes.razor and share the logs again?

@using Microsoft.Extensions.Options
@using Microsoft.Extensions.Localization
@using global::Localization.Resources.AbpUi
@using Microsoft.Extensions.Logging
@using Volo.Abp.AspNetCore.Components.Web.LeptonXTheme
@using Volo.Abp.AspNetCore.Components.Web.LeptonXTheme.Components
@using Volo.Abp.AspNetCore.Components.Web.LeptonXTheme.Components.ApplicationLayout
@using Volo.Abp.AspNetCore.Components.Web.Theming.Routing
@using Volo.Abp.AspNetCore.Components.WebAssembly.WebApp
@inject IOptions<AbpRouterOptions> RouterOptions
@inject IOptions<LeptonXThemeBlazorOptions> LayoutOptions
@inject IStringLocalizer<AbpUiResource> UiLocalizer
@inject ILogger<Routes> Logger
@inject NavigationManager NavigationManager

<CascadingAuthenticationState>
    <Router AppAssembly="typeof(Program).Assembly" AdditionalAssemblies="RouterOptions.Value.AdditionalAssemblies">
        <Found Context="routeData">
            <AuthorizeRouteView RouteData="@routeData" DefaultLayout="@LayoutOptions.Value.Layout">
                <NotAuthorized>
                    @if (context.User?.Identity?.IsAuthenticated != true)
                    {
                        <RedirectToLogin/>
                    }
                    else
                    {
                        <ErrorView
                            Title="@UiLocalizer["403Message"]"
                            HttpStatusCode="403"
                            Message="@UiLocalizer["403MessageDetail"]"/>
                    }
                </NotAuthorized>
            </AuthorizeRouteView>
        </Found>
        <NotFound>
            <LayoutView Layout="@LayoutOptions.Value.Layout">
                @{
                    Logger.LogWarning($"404 Not Found. Path: {NavigationManager.Uri}");
                }
                <ErrorView
                    Title="@UiLocalizer["404Message"]"
                    HttpStatusCode="404"
                    Message="@UiLocalizer["404MessageDetail"]"/>
            </LayoutView>
        </NotFound>
    </Router>
</CascadingAuthenticationState>

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

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

Hi,

How do I reproduce the problem?

Or can you share a test project with me? i will check it. shiwei.liang@volosoft.com

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.

Hi,

You can try this:

Configure<AuthorizationOptions>(options =>
{
    options.AddPolicy("TestPermission1_And_TestPermission2", policy =>
    {
        policy.Requirements.Add(new PermissionsRequirement(["TestPermission1", "TestPermission2"], requiresAll: true));
    });
    
    options.AddPolicy("TestPermission1_Or_TestPermission2", policy =>
    {
        policy.Requirements.Add(new PermissionsRequirement(new []{"TestPermission1", "TestPermission2"}, requiresAll: false));
    });
});
[Authorize("TestPermission1_And_TestPermission2")]

.....

[Authorize("TestPermission1_Or_TestPermission2")]

HI,

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

Hi,

You can try to override the RabbitMqDistributedEventBus and set ConsumerDispatchConcurrency

For example:

[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(IDistributedEventBus), typeof(RabbitMqDistributedEventBus), typeof(IRabbitMqDistributedEventBus))]
public class MyRabbitMqDistributedEventBus : RabbitMqDistributedEventBus
{
    protected List<IRabbitMqMessageConsumer> Consumers { get; private set; } = default!;
    
    public override Initialize()
    {
        // create consumers
        Consumers = new List....
        for(var i=0; i<3; i++)
        {
            Consumers.Add(MessageConsumerFactory.Create(
                new ExchangeDeclareConfiguration(
                    AbpRabbitMqEventBusOptions.ExchangeName,
                    type: AbpRabbitMqEventBusOptions.GetExchangeTypeOrDefault(),
                    durable: true,
                    arguments: AbpRabbitMqEventBusOptions.ExchangeArguments
                ),
                new QueueDeclareConfiguration(
                    AbpRabbitMqEventBusOptions.ClientName,
                    durable: true,
                    exclusive: false,
                    autoDelete: false,
                    prefetchCount: AbpRabbitMqEventBusOptions.PrefetchCount,
                    arguments: AbpRabbitMqEventBusOptions.QueueArguments
                ),
                AbpRabbitMqEventBusOptions.ConnectionName
            );
          )
        }
        
        foreach(var consumer in Consumers)
        {
            consumer.OnMessageReceived(ProcessEventAsync);
        }        

        SubscribeHandlers(AbpDistributedEventBusOptions.Handlers);
    }
    
    public override IDisposable Subscribe(Type eventType, IEventHandlerFactory factory)
    {
        var handlerFactories = GetOrCreateHandlerFactories(eventType);

        if (factory.IsInFactories(handlerFactories))
        {
            return NullDisposable.Instance;
        }

        handlerFactories.Add(factory);

        if (handlerFactories.Count == 1) //TODO: Multi-threading!
        {
            foreach(var consumer in Consumers)
            {
                Consumer.BindAsync(EventNameAttribute.GetNameOrDefault(eventType));
            }  
        }
        return new EventHandlerFactoryUnregistrar(this, eventType, factory);
    } 
}

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,

Is there a preferred way to handle this without relying on HttpContextAccessor?

It's best practice to get the current user token from the current http context

I can't reproduce the problem.

My steps:

  • Create a new project abp new Testapp -u blazor-server
  • Add extra property
ObjectExtensionManager.Instance.Modules()
    .ConfigureIdentity(identity =>
    {
        identity.ConfigureUser(user =>
        {
            user.AddOrUpdateProperty<int?>(
                "SupplierId",
                property =>
                {
                    property.UI.Lookup.Url = "/api/app/suppliers";
                    property.UI.Lookup.DisplayPropertyName = "companyName";
                }
            );
        });
    });
  • Add API endpoint
[Authorize]
[Route("api/app/suppliers")]
public class SuppliersController : AbpController
{
    [Route("")]
    public ListResultDto<TestDto>  GetAsync()
    {
        return new ListResultDto<TestDto>(
            new[]
            {
                new TestDto
                {
                    Id = 1,
                    CompanyName = "Apple"
                },
                new TestDto
                {
                    Id = 2,
                    CompanyName = "Microsoft"
                }
            }
        );
    }
}

public class TestDto
{
    public string CompanyName { get; set; }
    public int Id { get; set; }
}

Showing 261 to 270 of 6693 entries
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 v10.1.0-preview. Updated on November 04, 2025, 06:41