Open Closed

The requested service has not been registered exception #2148


User avatar
0
korolei created

Hi guys,

I'm trying to setup custom Setting Management Provider, as in your guide:https://docs.abp.io/en/abp/latest/Modules/Setting-Management, but get the following exception: ComponentNotRegisteredException: The requested service 'CustomSettingProvider' has not been registered.

  • ABP Framework version: v4.4

  • UI type:Blazor

  • DB provider: EF Core

  • Tiered (MVC) or Identity Server Separated (Angular): yes

  • Exception message and stack trace:ComponentNotRegisteredException: The requested service CustomSettingProvider' has not been registered. * Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable<Parameter> parameters) Volo.Abp.SettingManagement.SettingManager+<>c__DisplayClass12_0.<.ctor>b__1(Type c) System.Linq.Enumerable+SelectIListIterator<TSource, TResult>.ToList() Volo.Abp.SettingManagement.SettingManager+<>c__DisplayClass12_0.<.ctor>b__0() System.Lazy<T>.ViaFactory(LazyThreadSafetyMode mode) System.Lazy<T>.ExecutionAndPublication(LazyHelper executionAndPublication, bool useDefaultConstructor) System.Lazy<T>.CreateValue() Volo.Abp.SettingManagement.SettingManager.GetOrNullInternalAsync(string name, string providerName, string providerKey, bool fallback) Volo.Abp.Account.ExternalProviders.ExternalProviderSettingsHelper.GetSettingsListOrNullAsync(string providerName, string providerKey) Volo.Abp.Account.ExternalProviders.ExternalProviderSettingsHelper.GetSettingsAsync(ExternalProviderDefinition definition, string providerName, string providerKey) Volo.Abp.Account.ExternalProviders.ExternalProviderSettingsHelper.GetByNameAsync(string name, bool fallBackToHost) Volo.Abp.Account.ExternalProviders.AccountExternalProviderAppService.GetByNameAsync(GetByNameInput input) Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous<TResult>(IInvocation invocation, IInvocationProceedInfo proceedInfo) Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue<TResult>.ProceedAsync() Volo.Abp.GlobalFeatures.GlobalFeatureInterceptor.InterceptAsync(IAbpMethodInvocation invocation) Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter<TInterceptor>.InterceptAsync<TResult>(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func<IInvocation, IInvocationProceedInfo, Task<TResult>> proceed) Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous<TResult>(IInvocation invocation, IInvocationProceedInfo proceedInfo) Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue<TResult>.ProceedAsync() Volo.Abp.Auditing.AuditingInterceptor.ProceedByLoggingAsync(IAbpMethodInvocation invocation, IAuditingHelper auditingHelper, IAuditLogScope auditLogScope) Volo.Abp.Auditing.AuditingInterceptor.ProcessWithNewAuditingScopeAsync(IAbpMethodInvocation invocation, AbpAuditingOptions options, ICurrentUser currentUser, IAuditingManager auditingManager, IAuditingHelper auditingHelper) Volo.Abp.Auditing.AuditingInterceptor.ProcessWithNewAuditingScopeAsync(IAbpMethodInvocation invocation, AbpAuditingOptions options, ICurrentUser currentUser, IAuditingManager auditingManager, IAuditingHelper auditingHelper) Volo.Abp.Auditing.AuditingInterceptor.InterceptAsync(IAbpMethodInvocation invocation) Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter<TInterceptor>.InterceptAsync<TResult>(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func<IInvocation, IInvocationProceedInfo, Task<TResult>> proceed) Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous<TResult>(IInvocation invocation, IInvocationProceedInfo proceedInfo) Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue<TResult>.ProceedAsync() Volo.Abp.Validation.ValidationInterceptor.InterceptAsync(IAbpMethodInvocation invocation) Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter<TInterceptor>.InterceptAsync<TResult>(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func<IInvocation, IInvocationProceedInfo, Task<TResult>> proceed) Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous<TResult>(IInvocation invocation, IInvocationProceedInfo proceedInfo) Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue<TResult>.ProceedAsync() Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter<TInterceptor>.InterceptAsync<TResult>(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func<IInvocation, IInvocationProceedInfo, Task<TResult>> proceed) Volo.Abp.Account.Public.Web.ExternalProviders.AccountExternalProviderOptionsManager<TOptions>.OverrideOptionsAsync(string name, TOptions options) Volo.Abp.Account.Public.Web.ExternalProviders.AbpAccountAuthenticationRequestHandler<TOptions, THandler>.InitializeAsync(AuthenticationScheme scheme, HttpContext context) Microsoft.AspNetCore.Authentication.AuthenticationHandlerProvider.GetHandlerAsync(HttpContext context, string authenticationScheme) IdentityServer4.Hosting.FederatedSignOut.FederatedSignoutAuthenticationHandlerProvider.GetHandlerAsync(HttpContext context, string authenticationScheme) Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) Volo.Abp.AspNetCore.Tracing.AbpCorrelationIdMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) Microsoft.AspNetCore.Builder.UseMiddlewareExtensions+<>c__DisplayClass6_1+<<UseMiddlewareInterface>b__1>d.MoveNext() Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context) Microsoft.AspNetCore.RequestLocalization.AbpRequestLocalizationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) Microsoft.AspNetCore.Builder.UseMiddlewareExtensions+<>c__DisplayClass6_1+<<UseMiddlewareInterface>b__1>d.MoveNext() Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

  • Steps to reproduce the issue:"

* 1. Create CustomSettingProvider:
    public class CustomSettingProvider: SettingManagementProvider
    {
        public override string Name => "Custom";

        public CustomSettingProvider(ISettingManagementStore store) 
            : base(store)
        {
        }
    }
    2. Register in DomainModule:
                Configure<SettingManagementOptions>(options =>
                {
                    options.Providers.Add<CustomSettingProvider>();
                });

2 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Seems like you are using Blazor UI.

    Can you check this: https://docs.abp.io/en/abp/latest/Modules/Setting-Management#blazor-ui?

    You can also refer this: https://github.com/abpframework/abp/blob/dev/modules/setting-management/src/Volo.Abp.SettingManagement.Blazor/Settings/EmailingPageContributor.cs

  • User Avatar
    0
    korolei created

    Hi,

    Thanks for your reply. I did look at that information before. Adding 'ITransientDependency' interface to CustomSettingsProvider class, solved the issue. I provided PR for this: https://github.com/abpframework/abp/pull/10636

Made with ❤️ on ABP v9.1.0-preview. Updated on December 13, 2024, 06:09