Base solution for your next web application

Activities of "cmthomps"

Thanks - I'm using the permission checker right after the call to GetLoginAsync method. The result is always false. Wondering if the permissions get cached somehow later in the process. Not sure.

            var loginResult = await GetLoginResultAsync(loginModel.UsernameOrEmailAddress, loginModel.Password, GetTenancyNameOrNull());

            var hasPermissions = await PermissionChecker.IsGrantedAsync(AppPermissions.Permission1);

Any help?

I want to check a permission in the Login method of the AccountController. I'm checking a permission using PermissionChecker.IsGrantedAsync after GetLoginResultAsync, but it always comes back false. I'm assuming that the permissions get created sometime later. Is there away that I that I can accomplish that?

Thanks, Craig

Thanks @ismcagdas - Honestly, I have a workaround that seems to be working for us. The last time I checked, notifications do not work when using the StackExchange Redis Backplane but I have tried the v6.9.

Craig

Thanks @ismcagdas. I have a private github repository that I just shared with you. It contains an AspNetZero demo project that uses Redis for both Chat and Notifications. I've done some minimal testing. But it appears to work on Kubernetes running multiple pods behind a load balancer. Not sure if it's something that can be incorporated into the base product. For us, having the ability to run behind a load balancer is very important.

Here's a question for you. Have you tried to reproduce the issue I'm having on your machine with Redis and the StackExchangeRedis nuget package? When I run a straight, out of the box download of AspNetZero with no changes other than adding the StackExchangeRedis nuget package and adding the call to AddStackExchangeRedis in Startup.cs, the notifications do not work. Don't know what else to tell you.

I made no changes to the client side of things. In the Web.Mvc project, I changed a couple of things:

  1. In the Startup.cs ConfigureServices method, I changed
            var signalrBuilder = services.AddSignalR();

To

                var signalrBuilder = services.AddSignalR();
                signalrBuilder.AddStackExchangeRedis(_appConfiguration["SignalR:ConnectionString"], options => {
                        options.Configuration.ChannelPrefix = "smczero";
                        });
                }
  1. In the Configure method, I changed
            app.UseSignalR(routes =>
            {
                routes.MapHub<AbpCommonHub>("/signalr");
                routes.MapHub<ChatHub>("/signalr-chat");
            });

To

            app.UseSignalR(routes =>
            {
                routes.MapHub<SmcAbpCommonHub>("/signalr");
                routes.MapHub<ChatHub>("/signalr-chat");
            });

The last thing I did was register the register the SmcSignalRRealTimeNotifier as IRealTimeNotifier in my Web.Core project which is where the new module code lives.

Thanks @aaron. You're right.... That leads me to my next question. As part of this, I've created my own module that represents the ABP SignalRRealTimeNotifier called SmcSignalRRealTimeNotifier. In there, I've defined a my own AbpCommonHub called SmcAbpCommonHub. The code in the module is exactly the same as what is in ABP (Abp.AspNetCore.SignalR/AspNetCore/SignalR/).

When I use the AbpCommonHub in the Mvc startup.cs, the redis notifications do not work. When I override the SignalRRealTimeNotifier dependency with my own SmcSignalRRealTimeNotifier and use the SmcAbpCommonHub, the redis notifications start working. Can you think of a reason why that is?

Not sure. The first one does not work with Redis the second one does. I guess others will find this if they need it.

I'd like to vote for AspNetZero to enhance the product to support scale out using load balancing. Given the popularity of kubernetes, having this capability will be extremely valuable. I've got it running on kubernetes now, but finding that notifications and chat do not work. We got notifications to work using the hack above and I'm trying to get chat working with Redis using the code developed by another user. Haven't had any luck yet with Chat. All credit to personball on github.

RedisOnlineClientManager.cs

Here's what seems to have fixed it for me. I don't really understand why, but it seems to work nonetheless.

In the SendNotificationsAsync method, I changed the line that says:

signalRClient.SendAsync("getNotification", userNotification);

to

_hubContext.Clients.Client(onlineClient.ConnectionId).SendAsync("getNotification", userNotification);

Does that make any sense to you?  if I use the signalRClient object, it doesn't seem to send the notifications properly.

Showing 11 to 20 of 88 entries