Hi,
You can check this: https://support.abp.io/QA/Questions/3327/#answer-51baf847-087a-2aa1-1d76-3a04d9420894
hi
This code is working for me.
Thank you
Hi
I can try this code
var healthChecksUiBuilder = services.AddHealthChecksUI(settings =>
{
settings.AddHealthCheckEndpoint("MyProjectName Health Status", "https://yourwebsite.com/health-status");
});
services.MapHealthChecksUiEndpoints(options =>
{
options.UIPath = "https://yourwebsite.com/health-ui";
options.ApiPath = "https://yourwebsite.com/health-api";
});
error:
2022-07-20 03:39:56.518 -07:00 [FTL] Application startup exception
Volo.Abp.AbpInitializationException: An error occurred during the initialize Volo.Abp.Modularity.OnApplicationInitializationModuleLifecycleContributor phase of the module UBX_Client_Angular.UBX_Client_AngularHttpApiHostModule, UBX_Client_Angular.HttpApi.Host, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: The value for customized path can't be null and need to start with / character. (Parameter 'ApiPath'). See the inner exception for details.
---> System.ArgumentException: The value for customized path can't be null and need to start with / character. (Parameter 'ApiPath')
at Microsoft.AspNetCore.Builder.EndpointRouteBuilderExtensions.<>c.<EnsureValidApiOptions>b__1_0(String path, String argument) in /_/src/HealthChecks.UI/Extensions/EndpointRouteBuilderExtensions.cs:line 63
at Microsoft.AspNetCore.Builder.EndpointRouteBuilderExtensions.EnsureValidApiOptions(Options options) in /_/src/HealthChecks.UI/Extensions/EndpointRouteBuilderExtensions.cs:line 59
at Microsoft.AspNetCore.Builder.EndpointRouteBuilderExtensions.MapHealthChecksUI(IEndpointRouteBuilder builder, Action`1 setupOptions) in /_/src/HealthChecks.UI/Extensions/EndpointRouteBuilderExtensions.cs:line 17
at UBX_Client_Angular.HealthChecks.HealthChecksBuilderExtensions.<>c__DisplayClass2_0.<MapHealthChecksUiEndpoints>b__1(EndpointRouteBuilderContext endpointContext) in D:\Projects\UBX\aspnet-core\src\UBX_Client_Angular.HttpApi.Host\HealthChecks\HealthChecksBuilderExtensions.cs:line 67
at Microsoft.AspNetCore.Builder.AbpAspNetCoreApplicationBuilderExtensions.<>c__DisplayClass0_0.<UseConfiguredEndpoints>b__0(IEndpointRouteBuilder endpoints)
at Microsoft.AspNetCore.Builder.EndpointRoutingApplicationBuilderExtensions.UseEndpoints(IApplicationBuilder builder, Action`1 configure)
at Microsoft.AspNetCore.Builder.AbpAspNetCoreApplicationBuilderExtensions.UseConfiguredEndpoints(IApplicationBuilder app, Action`1 additionalConfigurationAction)
at UBX_Client_Angular.UBX_Client_AngularHttpApiHostModule.OnApplicationInitialization(ApplicationInitializationContext context) in D:\Projects\UBX\aspnet-core\src\UBX_Client_Angular.HttpApi.Host\UBX_Client_AngularHttpApiHostModule.cs:line 279
at Volo.Abp.Modularity.OnApplicationInitializationModuleLifecycleContributor.Initialize(ApplicationInitializationContext context, IAbpModule module)
at Volo.Abp.Modularity.ModuleManager.InitializeModules(ApplicationInitializationContext context)
--- End of inner exception stack trace ---
at Volo.Abp.Modularity.ModuleManager.InitializeModules(ApplicationInitializationContext context)
at Volo.Abp.AbpApplicationBase.InitializeModules()
at Volo.Abp.AbpApplicationWithExternalServiceProvider.Initialize(IServiceProvider serviceProvider)
at Microsoft.AspNetCore.Builder.AbpApplicationBuilderExtensions.InitializeApplication(IApplicationBuilder app)
at UBX_Client_Angular.Startup.Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory) in D:\Projects\UBX\aspnet-core\src\UBX_Client_Angular.HttpApi.Host\Startup.cs:line 17
at System.RuntimeMethodHandle.InvokeMethod(Object target, Span`1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.AspNetCore.Hosting.ConfigureBuilder.Invoke(Object instance, IApplicationBuilder builder)
at Microsoft.AspNetCore.Hosting.ConfigureBuilder.<>c__DisplayClass4_0.<Build>b__0(IApplicationBuilder builder)
at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass15_0.<UseStartup>b__1(IApplicationBuilder app)
at Microsoft.AspNetCore.Mvc.Filters.MiddlewareFilterBuilderStartupFilter.<>c__DisplayClass0_0.<Configure>g__MiddlewareFilterBuilder|0(IApplicationBuilder builder)
at Microsoft.AspNetCore.Server.IIS.Core.IISServerSetupFilter.<>c__DisplayClass2_0.<Configure>b__0(IApplicationBuilder app)
at Microsoft.AspNetCore.HostFilteringStartupFilter.<>c__DisplayClass0_0.<Configure>b__0(IApplicationBuilder app)
at Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken)
at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host)
at UBX_Client_Angular.Program.Main(String[] args) in D:\Projects\UBX\aspnet-core\src\UBX_Client_Angular.HttpApi.Host\Program.cs:line 32
thanks
hi,
I faced error
2022-07-20 02:52:34.184 -07:00 [ERR] GetHealthReport threw an exception when trying to get report from /health-status configured with name UBX_Client_Angular Health Status. System.InvalidOperationException: An invalid request URI was provided. Either the request URI must be an absolute URI or BaseAddress must be set. at System.Net.Http.HttpClient.PrepareRequestMessage(HttpRequestMessage request) at System.Net.Http.HttpClient.CheckRequestBeforeSend(HttpRequestMessage request) at System.Net.Http.HttpClient.SendAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken) at System.Net.Http.HttpClient.GetAsync(Uri requestUri, HttpCompletionOption completionOption) at HealthChecks.UI.Core.HostedService.HealthCheckReportCollector.GetHealthReportAsync(HealthCheckConfiguration configuration) in /_/src/HealthChecks.UI/Core/HostedService/HealthCheckReportCollector.cs:line 96
Hello,
I add new entity from Code Generator abp suite. successfully generated my code. but I click new entity menu in angular UI. faced error in console.
core.mjs:6494 ERROR Error: Uncaught (in promise): NullInjectorError: R3InjectorError(UserKeyModule)[ScrollbarHelper -> ScrollbarHelper -> ScrollbarHelper -> ScrollbarHelper]: NullInjectorError: No provider for ScrollbarHelper! NullInjectorError: R3InjectorError(UserKeyModule)[ScrollbarHelper -> ScrollbarHelper -> ScrollbarHelper -> ScrollbarHelper]: NullInjectorError: No provider for ScrollbarHelper! at NullInjector.get (core.mjs:11157:1) at R3Injector.get (core.mjs:11324:1) at R3Injector.get (core.mjs:11324:1) at R3Injector.get (core.mjs:11324:1) at NgModuleRef.get (core.mjs:21888:1) at R3Injector.get (core.mjs:11324:1) at NgModuleRef.get (core.mjs:21888:1) at Object.get (core.mjs:21565:1) at lookupTokenUsingModuleInjector (core.mjs:3367:1) at getOrCreateInjectable (core.mjs:3479:1) at resolvePromise (zone.js:1213:1) at resolvePromise (zone.js:1167:1) at zone.js:1279:1 at ZoneDelegate.invokeTask (zone.js:406:1) at Object.onInvokeTask (core.mjs:25595:1) at ZoneDelegate.invokeTask (zone.js:405:1) at Zone.runTask (zone.js:178:1) at drainMicroTaskQueue (zone.js:582:1)
please solve this error
Thanks
Hello
Configure<AbpClaimsServiceOptions>(options => { options.RequestedClaims.AddRange(new[]{ "SocialSecurityNumber" }); });
After adding this code working fine.
Thank you
hello
"access_token": "eyJhbGciOiJSUzI1NiIsImtpZCI6IjcyQ0E3N0Y4NUZBQ0ZBQkUxNThGQkIzMkU3NEM4MUVCIiwidHlwIjoiYXQrand0In0.eyJuYmYiOjE2NTcwODgzMDgsImV4cCI6MTY4ODYyNDMwOCwiaXNzIjoiaHR0cHM6Ly9sb2NhbGhvc3Q6NDQzODgiLCJhdWQiOiJVQlhfQ2xpZW50X0FuZ3VsYXIiLCJjbGllbnRfaWQiOiJVQlhfQ2xpZW50X0FuZ3VsYXJfQXBwIiwic3ViIjoiNDc5NTkyYmUtZTQzNS1kZWNiLTczZWMtMzlmZjE0OTU0YzYwIiwiYXV0aF90aW1lIjoxNjU3MDg4MzAzLCJpZHAiOiJsb2NhbCIsImh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3dzLzIwMDUvMDUvaWRlbnRpdHkvY2xhaW1zL2dpdmVubmFtZSI6ImFkbWluIiwidW5pcXVlX25hbWUiOiJhZG1pbiIsInByZWZlcnJlZF91c2VybmFtZSI6ImFkbWluIiwiZ2l2ZW5fbmFtZSI6ImFkbWluIiwicm9sZSI6ImFkbWluIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjoiRmFsc2UiLCJlbWFpbCI6ImFkbWluQGFicC5pbyIsImVtYWlsX3ZlcmlmaWVkIjoiRmFsc2UiLCJuYW1lIjoiYWRtaW4iLCJzaWQiOiIyNUQxMzA3MUQxNDA1REM3Q0U4RkExMEUxMTc0QjcyNyIsImlhdCI6MTY1NzA4ODMwOCwic2NvcGUiOlsib3BlbmlkIiwicHJvZmlsZSIsInJvbGUiLCJlbWFpbCIsInBob25lIiwiVUJYX0NsaWVudF9Bbmd1bGFyIiwib2ZmbGluZV9hY2Nlc3MiXSwiYW1yIjpbInB3ZCJdfQ.ftoo73-sndK4SZP34J7n1Onqg9UY7ireubbr7H7Ft8uw5wcSP8dOXaakDXButlLH0V_FiCcy9SOEIRNO7Viqyp7iJnFc2lFZZ1DGhYWcJsiSUE9b6sgJmWpEOWMarISwgbODjDeX3YQZY--l8Dgg1lErsceVy2FP-ZhAD0uFzOILqFqTG670_2WzCrNIlysxdHlqG7Srdm7NWKowFHPAtNJfpP7tbCci3j75awd4M-6JM-NFa1IYohbmSpHawFRLep4BNQSCSwvqT6EnRazF7AccF2wfFf2VO2oXn2p1GauGjwSuHb6qfZg7gO_TnASXWJA-Prq_4PNNyxMKmjy65w",
Hello,
I try to re-login but I am unable to get the claim.
hello
public class SocialSecurityNumberClaimsPrincipalContributor : 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<IUserService>(); //Your custom service
//var socialSecurityNumber = await userService.GetSocialSecurityNumberAsync(userId.Value);
var socialSecurityNumber = "123456789";
if (socialSecurityNumber != null)
{
identity.AddClaim(new Claim("SocialSecurityNumber", socialSecurityNumber));
}
}
}
}
I add an IAbpClaimsPrincipalContributor in class. Working fine this code if I use the api from swagger, but when I call the api from angular project, I am unable to get the claim.
Hi Maliming,
Thanks for your reply,
I share my code
[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(AbpUserClaimsPrincipalFactory))]
public class UBXUserClaimsPrincipalFactory : AbpUserClaimsPrincipalFactory, ITransientDependency
{
public UBXUserClaimsPrincipalFactory(UserManager<Volo.Abp.Identity.IdentityUser> userManager, RoleManager<Volo.Abp.Identity.IdentityRole> roleManager, IOptions<IdentityOptions> options, ICurrentPrincipalAccessor currentPrincipalAccessor, IAbpClaimsPrincipalFactory abpClaimsPrincipalFactory) : base(userManager, roleManager, options, currentPrincipalAccessor, abpClaimsPrincipalFactory)
{
}
[UnitOfWork]
public override async Task<ClaimsPrincipal> CreateAsync(Volo.Abp.Identity.IdentityUser user)
{
var principal = await base.CreateAsync(user).ConfigureAwait(false);
principal.Identities
.First()
.AddClaim(new Claim("ApiKey", "712bfe60b83028da5XpkbpC6IgW0Fkagi0rWhay1nm7Ru6FzuYx5t6i2GX3PkoN7odDyNL463t5qZvM3WmMqUA67g2syy0rY3Trmhah5JXQXXYargIH4iGu3BObWIWwC"));
return principal;
}
}
public override void PreConfigureServices(ServiceConfigurationContext context)
{
PreConfigure<IdentityBuilder>(builder =>
{
builder.AddClaimsPrincipalFactory<UBXUserClaimsPrincipalFactory>();
});
}