I upgraded the version of Blazorise. Currently, I am using Blazorise 1.5.3 because I need some components and functions of the new version. However, I see that starting from version 1.4, there will be some limitations without a license.we are using commercial version of abp to develop blazor server application and would like the commercial key please,
public async Task SendToUsersAsync<T>(T message) where T : SigalRMessage
{
try
{
if (!message.UserIds.HasItems())
return;
var stringUserIds = message.UserIds.Where(s => !s.IsNullOrEmpty()).Select(x => x.Value.ToString()).ToList();
await _hubContext.Clients.Users(stringUserIds).SendAsync(message.MessageType.ToString(), message);
}
catch (Exception ex)
{
_logger.LogError(ex, "error");
}
}
protected override async Task OnInitializedAsync()
{
SetTableOption();
var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
var user = authState.User;
var claims = CurrentUser.GetAllClaims();
var headers = new Dictionary<string, string>();
foreach (var claim in claims)
{
if (!headers.Keys.Contains(claim.Type))
headers.Add(claim.Type, claim.Value);
}
_userToken = user.FindFirstValue("access_token");
var signalRUrl = "wss://localhost:44320".EnsureEndsWith('/') + Configuration["HubUrl"].TrimStart('/');
HubConnection = new HubConnectionBuilder()
.WithUrl(signalRUrl, options =>
{
options.Headers = headers;
options.AccessTokenProvider = () => Task.FromResult(_userToken);
}).WithAutomaticReconnect().Build();
// 2. 定义客户端方法以接收服务器消息
HubConnection.On<SigalRMessage<Dictionary<string, string>>>(SigalRMessageTypeEnum.OrderSyncSuccess.ToString(), async message =>
{
await JSRuntime.InvokeVoidAsync("console.log", $"收到sigalr消息:{message.ToJson()} {DateTime.Now:yyyy-MM-dd HH:mm:ss}");
StateHasChanged();
});
await HubConnection.StartAsync();
}
I looked at some sample code
[Inject]
protected IAbpAccessTokenProvider AccessTokenProvider { get; set; }
[Inject]
protected IOptions<ChatBlazorMauiBlazorOptions> ChatBlazorMauiBlazorOptions { get; set; }
[Inject]
protected IOptions<AbpRemoteServiceOptions> AbpRemoteServiceOptions { get; set; }
protected async override Task SetChatHubConnectionAsync()
{
var accessToken = await AccessTokenProvider.GetTokenAsync();
var signalrUrl = ChatBlazorMauiBlazorOptions.Value.SignalrUrl ?? AbpRemoteServiceOptions.Value.RemoteServices.Default.BaseUrl;
HubConnection = new HubConnectionBuilder()
.WithUrl(signalrUrl.EnsureEndsWith('/') + "signalr-hubs/chat", options =>
{
options.AccessTokenProvider = () => Task.FromResult(accessToken);
})
.Build();
}
But IAbpAccessTokenProvider does not seem to exist in abp7.2.3 version
Could you share the full logs? (both local and deployed) thanks. server logs : 2024-04-01 15:32:49.553 +08:00 [WRN] ---------- RemoteServiceErrorInfo ---------- { "code": "Volo.Authorization:010001", "message": "Authorization failed! Given policy has not granted.", "details": null, "data": {}, "validationErrors": null } 2024-04-01 15:32:49.554 +08:00 [WRN] Exception of type 'Volo.Abp.Authorization.AbpAuthorizationException' was thrown. Volo.Abp.Authorization.AbpAuthorizationException: Exception of type 'Volo.Abp.Authorization.AbpAuthorizationException' was thrown. at Microsoft.AspNetCore.Authorization.AbpAuthorizationServiceExtensions.CheckAsync(IAuthorizationService authorizationService, AuthorizationPolicy policy) at Volo.Abp.Authorization.MethodInvocationAuthorizationService.CheckAsync(MethodInvocationAuthorizationContext context) at Volo.Abp.Authorization.AuthorizationInterceptor.AuthorizeAsync(IAbpMethodInvocation invocation) at Volo.Abp.Authorization.AuthorizationInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync() at Volo.Abp.GlobalFeatures.GlobalFeatureInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync() at Volo.Abp.Auditing.AuditingInterceptor.ProceedByLoggingAsync(IAbpMethodInvocation invocation, AbpAuditingOptions options, IAuditingHelper auditingHelper, IAuditLogScope auditLogScope) at Volo.Abp.Auditing.AuditingInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync() at Volo.Abp.Validation.ValidationInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync() 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 lambda_method5145(Closure, Object) at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) 2024-04-01 15:32:49.556 +08:00 [WRN] Code:Volo.Authorization:010001 2024-04-01 15:32:49.556 +08:00 [INF] AuthenticationScheme: Identity.Application was challenged. 2024-04-01 15:32:49.556 +08:00 [INF] Executed action PDT.Platform.Controllers.QuarantineRecords.QuarantineRecordController.GetListAsync (PDT.Platform.HttpApi) in 8.3655ms 2024-04-01 15:32:49.556 +08:00 [INF] Executed endpoint 'PDT.Platform.Controllers.QuarantineRecords.QuarantineRecordController.GetListAsync (PDT.Platform.HttpApi)' 2024-04-01 15:32:49.578 +08:00 [INF] Request finished HTTP/1.0 GET http://pdtapi.loda.net.cn/api/quarantine-records/backend/getlist application/json - - 302 0 - 35.3289ms 2024-04-01 15:32:49.593 +08:00 [INF] Request starting HTTP/1.0 GET http://pdtapi.loda.net.cn/Error?httpStatusCode=401 - - 2024-04-01 15:32:49.596 +08:00 [INF] Executing endpoint 'Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Controllers.ErrorController.Index (Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared)' 2024-04-01 15:32:49.596 +08:00 [INF] Route matched with {action = "Index", controller = "Error", area = "", page = ""}. Executing controller action with signature System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Mvc.IActionResult] Index(Int32) on controller Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Controllers.ErrorController (Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared). 2024-04-01 15:32:49.597 +08:00 [INF] Executing ViewResult, running view ~/Views/Error/401.cshtml. 2024-04-01 15:32:49.598 +08:00 [WRN] The cookie 'XSRF-TOKEN' has set 'SameSite=None' and must also set 'Secure'. 2024-04-01 15:32:49.601 +08:00 [INF] Executed ViewResult - view ~/Views/Error/401.cshtml executed in 3.984ms.
<br> local logs: 2024-04-01 15:30:55.682 +08:00 [WRN] ---------- RemoteServiceErrorInfo ---------- { "code": "Volo.Authorization:010001", "message": "Authorization failed! Given policy has not granted.", "details": null, "data": {}, "validationErrors": null } 2024-04-01 15:30:55.682 +08:00 [WRN] Exception of type 'Volo.Abp.Authorization.AbpAuthorizationException' was thrown. Volo.Abp.Authorization.AbpAuthorizationException: Exception of type 'Volo.Abp.Authorization.AbpAuthorizationException' was thrown. at Microsoft.AspNetCore.Authorization.AbpAuthorizationServiceExtensions.CheckAsync(IAuthorizationService authorizationService, AuthorizationPolicy policy) at Volo.Abp.Authorization.MethodInvocationAuthorizationService.CheckAsync(MethodInvocationAuthorizationContext context) at Volo.Abp.Authorization.AuthorizationInterceptor.AuthorizeAsync(IAbpMethodInvocation invocation) at Volo.Abp.Authorization.AuthorizationInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync() at Volo.Abp.GlobalFeatures.GlobalFeatureInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync() at Volo.Abp.Auditing.AuditingInterceptor.ProceedByLoggingAsync(IAbpMethodInvocation invocation, AbpAuditingOptions options, IAuditingHelper auditingHelper, IAuditLogScope auditLogScope) at Volo.Abp.Auditing.AuditingInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync() at Volo.Abp.Validation.ValidationInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync() 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 lambda_method3659(Closure, Object) at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) 2024-04-01 15:30:55.682 +08:00 [WRN] Code:Volo.Authorization:010001 2024-04-01 15:30:55.683 +08:00 [INF] AuthenticationScheme: Identity.Application was challenged. 2024-04-01 15:30:55.683 +08:00 [INF] Executed action PDT.Platform.Controllers.QuarantineRecords.QuarantineRecordController.GetListAsync (PDT.Platform.HttpApi) in 11.8705ms 2024-04-01 15:30:55.683 +08:00 [INF] Executed endpoint 'PDT.Platform.Controllers.QuarantineRecords.QuarantineRecordController.GetListAsync (PDT.Platform.HttpApi)' 2024-04-01 15:30:55.727 +08:00 [DBG] Added 0 entity changes to the current audit log 2024-04-01 15:30:55.729 +08:00 [DBG] Added 0 entity changes to the current audit log 2024-04-01 15:30:55.731 +08:00 [INF] Request finished HTTP/1.1 GET https://localhost:44312/api/quarantine-records/backend/getlist application/json 328 - 401 - - 68.1606ms 2024-04-01 15:31:04.981 +08:00 [DBG] Executing HealthCheck collector HostedService. 2024-04-01 15:31:04.982 +08:00 [INF] Start processing HTTP request GET https://localhost:44312/health-status 2024-04-01 15:31:04.982 +08:00 [INF] Sending HTTP request GET https://localhost:44312/health-status
Hi,
Could you try this? https://github.com/abpframework/abp/blob/dev/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyProjectNameWebModule.cs#L118
It exists when the project is generated. I did not delete it
Check the docs before asking a question: https://docs.abp.io/en/commercial/latest/ Check the samples to see the basic tasks: https://docs.abp.io/en/commercial/latest/samples/index The exact solution to your question may have been answered before, and please first use the search on the homepage. Provide us with the following info:
Hi,you can try running the project and stay on the testing book list. After an hour of token expiration, clicking the query button again will cause the page to flicker continuously until the program crashes.
hi
The page will keep flashing. AbpComponentsBase is not used, but a custom base class, in which the exception handling code:
Please share a test template project with your custom code. liming.ma@volosoft.com
Thanks.
Already send for your email