i flowed the doc and added the chat module in a **microservice ** . add the volo.chat to the {projectname}.blazor then added the
app.Use(async (httpContext, next) =>
{
var accessToken = httpContext.Request.Query["access_token"];
var path = httpContext.Request.Path;
if (!string.IsNullOrEmpty(accessToken) &&
(path.StartsWithSegments("/signalr-hubs/chat")))
{
httpContext.Request.Headers["Authorization"] = "Bearer " + accessToken;
}
await next();
});
to the blazor server app. but now there is an error
[blazor_e61ab55f-b]: [11:10:27 INF] Request finished HTTP/1.1 POST https://localhost:44314/signalr-hubs/chat/negotiate?negotiateVersion=1 - 0 - 400 0 - 0.7379ms
[blazor_e61ab55f-b]: [11:10:27 WRN] Unhandled exception rendering component: Response status code does not indicate success: 400 (Bad Request).
[blazor_e61ab55f-b]: System.Net.Http.HttpRequestException: Response status code does not indicate success: 400 (Bad Request).
[blazor_e61ab55f-b]: at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
[blazor_e61ab55f-b]: at Microsoft.AspNetCore.Http.Connections.Client.HttpConnection.NegotiateAsync(Uri url, HttpClient httpClient, ILogger logger, CancellationToken cancellationToken)
[blazor_e61ab55f-b]: at Microsoft.AspNetCore.Http.Connections.Client.HttpConnection.GetNegotiationResponseAsync(Uri uri, CancellationToken cancellationToken)
[blazor_e61ab55f-b]: at Microsoft.AspNetCore.Http.Connections.Client.HttpConnection.SelectAndStartTransport(TransferFormat transferFormat, CancellationToken cancellationToken)
[blazor_e61ab55f-b]: at Microsoft.AspNetCore.Http.Connections.Client.HttpConnection.StartAsyncCore(TransferFormat transferFormat, CancellationToken cancellationToken)
[blazor_e61ab55f-b]: at System.Threading.Tasks.ForceAsyncAwaiter.GetResult()
[blazor_e61ab55f-b]: at Microsoft.AspNetCore.Http.Connections.Client.HttpConnection.StartAsync(TransferFormat transferFormat, CancellationToken cancellationToken)
[blazor_e61ab55f-b]: at Microsoft.AspNetCore.Http.Connections.Client.HttpConnectionFactory.ConnectAsync(EndPoint endPoint, CancellationToken cancellationToken)
[blazor_e61ab55f-b]: at Microsoft.AspNetCore.Http.Connections.Client.HttpConnectionFactory.ConnectAsync(EndPoint endPoint, CancellationToken cancellationToken)
[blazor_e61ab55f-b]: at Microsoft.AspNetCore.SignalR.Client.HubConnection.StartAsyncCore(CancellationToken cancellationToken)
[blazor_e61ab55f-b]: at Microsoft.AspNetCore.SignalR.Client.HubConnection.StartAsyncInner(CancellationToken cancellationToken)
[blazor_e61ab55f-b]: at System.Threading.Tasks.ForceAsyncAwaiter.GetResult()
[blazor_e61ab55f-b]: at Microsoft.AspNetCore.SignalR.Client.HubConnection.StartAsync(CancellationToken cancellationToken)
[blazor_e61ab55f-b]: at Volo.Chat.Blazor.Components.MessagesToolbarItem.OnInitializedAsync()
[blazor_e61ab55f-b]: at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()
[blazor_e61ab55f-b]: at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)
[blazor_e61ab55f-b]: [11:10:27 ERR] Unhandled exception in circuit 'AbGz5Sf6tRmRB9LTKUMsV1s_0qNpKbp2iTBg41nPdFE'.
1 optionsAction) [blazor_de264e9c-4]: at Volo.Abp.AbpApplicationWithExternalServiceProvider..ctor(Type startupModuleType, IServiceCollection services, Action
1 optionsAction)
[blazor_de264e9c-4]: at Volo.Abp.AbpApplicationFactory.Create(Type startupModuleType, IServiceCollection services, Action1 optionsAction) [blazor_de264e9c-4]: at Volo.Abp.AbpApplicationFactory.Create[TStartupModule](IServiceCollection services, Action
1 optionsAction)
[blazor_de264e9c-4]: at Microsoft.Extensions.DependencyInjection.ServiceCollectionApplicationExtensions.AddApplication[TStartupModule](IServiceCollection services, Action1 optionsAction) [blazor_de264e9c-4]: at CP.Blazor.Startup.ConfigureServices(IServiceCollection services) in D:\CP\apps\blazor-server\src\CP.Blazor\Startup.cs:line 11 [blazor_de264e9c-4]: at System.RuntimeMethodHandle.InvokeMethod(Object target, Span
1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
[blazor_de264e9c-4]: at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
[blazor_de264e9c-4]: at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.InvokeCore(Object instance, IServiceCollection services)
[blazor_de264e9c-4]: at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass9_0.<Invoke>g__Startup|0(IServiceCollection serviceCollection)
[blazor_de264e9c-4]: at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.Invoke(Object instance, IServiceCollection services)
[blazor_de264e9c-4]: at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass8_0.<Build>b__0(IServiceCollection services)
[blazor_de264e9c-4]: at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.UseStartup(Type startupType, HostBuilderContext context, IServiceCollection services, Object instance)
[blazor_de264e9c-4]: at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass13_0.<UseStartup>b__0(HostBuilderContext context, IServiceCollection services)
[blazor_de264e9c-4]: at Microsoft.Extensions.Hosting.HostBuilder.CreateServiceProvider()
[blazor_de264e9c-4]: at Microsoft.Extensions.Hosting.HostBuilder.Build()
[blazor_de264e9c-4]: at CP.Blazor.Program.Main(String[] args) in D:\CP\apps\blazor-server\src\CP.Blazor\Program.cs:line 21the result in swagger is like this. { "data": [ { "report": { "reportName": "54321", "fileName": "报表", "dtoName": "CP.ReportService.Reports.ReportWithNavigationPropertiesDto", "iAppServiceName": "CP.ReportService.Reports.IReportsAppService", "getMethodName": "GetDxReportsAsync", "pageName": "CP.ReportService.Blazor.Pages.ReportService.Reports", "moduleName": "CP.ReportService.Blazor.ReportServiceBlazorModule", "creatorOuId": "00000000-0000-0000-0000-000000000000", "moduleId": "6e9df9da-353f-f99a-1496-3a0319326f0d", "isDeleted": false, "deleterId": null, "deletionTime": null, "lastModificationTime": "2022-04-27T08:51:30.9189059", "lastModifierId": "011a204f-b914-e9c7-eaba-3a037a9d79ec", "creationTime": "2022-04-22T10:44:03.704465", "creatorId": "760fbf89-c292-8265-b846-3a01f3e5f77c", "extraProperties": {}, "concurrencyStamp": "4940f6a8b1844df6bb155b6e0ed7b007", "id": "b550a7c7-679d-35ed-f918-3a0361548bcc" }, "module": { "moduleName": "OA模块", "creatorOuId": "d7ae3bfe-c42e-0582-878f-3a0279b85e20", "isDeleted": false, "deleterId": null, "deletionTime": null, "lastModificationTime": null, "lastModifierId": null, "creationTime": "2022-04-08T10:34:08.6577346", "creatorId": "760fbf89-c292-8265-b846-3a01f3e5f77c", "extraProperties": {}, "concurrencyStamp": "7667d696451a478c8884a7c531d30209", "id": "6e9df9da-353f-f99a-1496-3a0319326f0d" } } ], "totalCount": -1, "groupCount": -1, "summary": null }
after deserialized it liked this.
ValueKind = Object : "{"report":{"reportName":"54321","fileName":"报表","dtoName":"CP.ReportService.Reports.ReportWithNavigationPropertiesDto","iAppServiceName":"CP.ReportService.Reports.IReportsAppService","getMethodName":"GetDxReportsAsync","pageName":"CP.ReportService.Blazor.Pages.ReportService.Reports","moduleName":"CP.ReportService.Blazor.ReportServiceBlazorModule","creatorOuId":"00000000-0000-0000-0000-000000000000","moduleId":"6e9df9da-353f-f99a-1496-3a0319326f0d","isDeleted":false,"deleterId":null,"deletionTime":null,"lastModificationTime":"2022-04-27T08:51:30.9189059","lastModifierId":"011a204f-b914-e9c7-eaba-3a037a9d79ec","creationTime":"2022-04-22T10:44:03.704465","creatorId":"760fbf89-c292-8265-b846-3a01f3e5f77c","extraProperties":{},"concurrencyStamp":"4940f6a8b1844df6bb155b6e0ed7b007","id":"b550a7c7-679d-35ed-f918-3a0361548bcc"},"module":{"moduleName":"OA模块","creatorOuId":"d7ae3bfe-c42e-0582-878f-3a0279b85e20","isDeleted":false,"deleterId":null,"deletionTime":null,"lastModificationTime":null,"lastModifierId":null,"creationTime":"2022-04-08T10:34:08.6577346","creatorId":"760fbf89-c292-8265-b846-3a01f3e5f77c","extraProperties":{},"concurrencyStamp":"7667d696451a478c8884a7c531d30209","id":"6e9df9da-353f-f99a-1496-3a0319326f0d"}}"
i don't need the "ValueKind = Object : {}"" how can i fix this.
https://support.abp.io/QA/Questions/1433/How-to-add-extra-information-to-CurrentUserCheck 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, please use the search on the homepage.
If you're creating a bug/problem report, please include followings:
https://docs.abp.io/en/abp/latest/Authorization#advanced-topics https://support.abp.io/QA/Questions/1433/How-to-add-extra-information-to-CurrentUser Hi I want to get currentuser's OU ID, I followed the doc add codes below in my service domain project. then use this.CurrentUser.FindClaim("OrganizationId"); to get OrganizationId in my blazor project. but it always is null. what do i miss?
public class OrgClaimsPrincipalContributor : IAbpClaimsPrincipalContributor, ITransientDependency
{
public async Task ContributeAsync(AbpClaimsPrincipalContributorContext context)
{
//var identity = context.ClaimsPrincipal.Identities.FirstOrDefault();
//var userId = identity?.FindUserId();
//if (userId.HasValue)
//{
// //var userService = context.ServiceProvider.GetRequiredService<IdentityUserAppService>(); //Your custom service
// //var OrgList = await userService.GetOrganizationUnitsAsync(userId.Value);
// //var Org = OrgList.ToList().FirstOrDefault();
// //if (Org != null)
// //{
// // var Claim = new Claim("OrganizationId", "123");
// // identity.AddClaim(Claim);
// //}
// var Claim = new Claim("OrganizationId", "123");
// identity.AddClaim(Claim);
//}
var identity = context.ClaimsPrincipal.Identities.FirstOrDefault();
identity.AddClaim(new Claim("OrganizationId", "OrganizationValue"));
}
}
var orgid = this.CurrentUser.FindClaim("OrganizationId");
Hello I want to get all the User Role Org entities from IdentityDbContext in my .*EntityFrameworkCore project How can I achieve that? thanks~ or are there User Role Org cache in Redis ?
Hi guys
I created an api like
[HttpGet]
[Route("dx/[action]")]
public virtual Task<LoadResult> GetDxListAsync(DataSourceLoadOptionsBase input)//[FromBody]
{
return _mailsAppService.GetDxListAsync(input);
}
There is a complex parameter(DataSourceLoadOptionsBase ) in my API. and generate a static client. but"Volo.Abp.Http.Client.ClientProxying" didn't handle it well.
then i found that in v5.0. there is a way to handle it myself. github so I add those code in my service's Httpapi.client
//in OaServiceHttpApiClientModule
Configure<AbpHttpClientProxyingOptions>(options =>
{
options.QueryStringConverts.Add(typeof(DataSourceLoadOptionsBase), typeof(DataSourceLoadOptionsBaseToQueryString));
});
//static
context.Services.AddStaticHttpClientProxies(
typeof(OaServiceApplicationContractsModule).Assembly
);
//DataSourceLoadOptionsBaseToQueryString.cs
public class DataSourceLoadOptionsBaseToQueryString : IObjectToQueryString<DataSourceLoadOptionsBase>, ITransientDependency
{
public Task<string> ConvertAsync(DataSourceLoadOptionsBase values)
{
if (values==null)
{
return null;
}
return Task.FromResult("12345678");
}
}
but after i called the method "GetDxListAsync" in my blazor client nothing happened.
is there someone can help me?
HI guys I creat a microserve with abp suite,then add the services\product in it.when i creat a crud page I get error "can't find the Volo.Abp.Commercial.SuiteTemplates.dll", the dll doesn't exist in "bin\Debug\net5.0" like this url support.so I use " abp add-package Volo.Abp.Commercial.SuiteTemplates" to add the SuiteTemplates to my product.blazor project. then i get the curd page created.but when I try to build the project,I get lots of errors. one kind is "The name 'xxx' does not exist in the current context" like the L method, other one is "'OnInitializedAsync' : no suitable method found to override". the razor page has this line" @inherits ProductServiceComponentBase". I don't know how to fix and what i missed.
I have few questiones. Q1 Is the microserve project need to add the "SuiteTemplates.dll" manualy? Q2 Why the errors("cs0115,cs0103") came.how should i fix ? PS:I am dealing the problem few days.i tried to uninstall cli and the abp suite. created a new project,but noting worked. please help me out.