Starts in:
2 DAYS
0 HR
18 MIN
4 SEC
Starts in:
2 D
0 H
18 M
4 S
Open Closed

SignalR Chat Hub Dependencies Cannot Be Resolved #387


User avatar
0
nick.pham-mwp created

Check the docs before asking a question: https://docs.abp.io/en/commercial/latest/

  • nothing found related to my inquiry

Check the samples, to see the basic tasks: https://docs.abp.io/en/commercial/latest/samples/index

  • have followed the Volo.Chat sample:
    • the sample works, but
    • the chat feature integrated in my solution does not

The exact solution to your question may have been answered before, please use the search on the homepage.

  • nothing found (100%) related to my inquiry
    • https://support.abp.io/QA/Questions/331/SignalR-Hub-Service-Dependency-Error
    • https://github.com/abpframework/abp/issues/1680
    • https://github.com/abpframework/abp/issues/1462
    • https://github.com/abpframework/abp/issues/1384

Details:

  • ABP Framework version: v3.0.5
  • UI type: MVC Razor
  • Tiered (MVC) or Identity Server Seperated (Angular): unsure sorry, but I think it is Tiered (MVC)
  • Exception message and stack trace:
    • 2020-08-31 11:54:33.262 +10:00 [ERR] Error when dispatching 'OnConnectedAsync' on hub. Autofac.Core.DependencyResolutionException: An exception was thrown while activating Castle.Proxies.ChatHubProxy. ---> Autofac.Core.DependencyResolutionException: None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type 'Castle.Proxies.ChatHubProxy' can be invoked with the available services and parameters: Cannot resolve parameter 'Volo.Abp.Identity.IIdentityUserRepository identityUserRepository' of constructor 'Void .ctor(Castle.DynamicProxy.IInterceptor[], Volo.Abp.Identity.IIdentityUserRepository, Microsoft.AspNetCore.Identity.ILookupNormalizer)'. at Autofac.Core.Activators.Reflection.ReflectionActivator.GetValidConstructorBindings(ConstructorInfo[] availableConstructors, IComponentContext context, IEnumerable1 parameters) at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable1 parameters) at Autofac.Core.Resolving.InstanceLookup.CreateInstance(IEnumerable1 parameters) --- End of inner exception stack trace --- at Autofac.Core.Resolving.InstanceLookup.CreateInstance(IEnumerable1 parameters) at Autofac.Core.Resolving.InstanceLookup.Execute() at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, ResolveRequest request) at Autofac.Core.Resolving.ResolveOperation.Execute(ResolveRequest request) at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable1 parameters, Object& instance) at Autofac.ResolutionExtensions.ResolveOptionalService(IComponentContext context, Service service, IEnumerable1 parameters) at Autofac.ResolutionExtensions.ResolveOptional(IComponentContext context, Type serviceType, IEnumerable1 parameters) at Autofac.ResolutionExtensions.ResolveOptional(IComponentContext context, Type serviceType) at Autofac.Extensions.DependencyInjection.AutofacServiceProvider.GetService(Type serviceType) at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[T](IServiceProvider provider) at Microsoft.AspNetCore.SignalR.Internal.DefaultHubActivator1.Create() at Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher1.OnConnectedAsync(HubConnectionContext connection) at Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher1.OnConnectedAsync(HubConnectionContext connection) at Microsoft.AspNetCore.SignalR.HubConnectionHandler1.RunHubAsync(HubConnectionContext connection) 2020-08-31 11:54:33.359 +10:00 [INF] Executed endpoint '/signalr-hubs/chat' 2020-08-31 11:54:33.360 +10:00 [INF] Request finished in 296.7416ms 101 `
  • Steps to reproduce the issue:
    • Note: both IIdentityUserRepository and ILookupNormalizer fail to be resolved. (Removing them both) AND (hard-coding User Id OR sending messages to ALL users) works

Your kind help to resolve Volo.Abp.Identity.IIdentityUserRepository and Microsoft.AspNetCore.Identity.ILookupNormalizer (via Autofac) is greatly appreciated, please.

Thanks

Nick


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

    Hi,

    I can't reproduce your problem, can you provide an example to reproduce? Thanks. You can send the example to my email : shiwei.liang@volosoft.com.

  • User Avatar
    0
    nick.pham-mwp created

    hi @liangshiwei

    i have emailed you the source

    Your help is greatly appreciated

    Thanks

    Nick

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Because you are using tiered template, the .web project just a UI layer. If you want use repository, you need add .EntityFrameworkCore module dependencies to the web module. like:

  • User Avatar
    0
    nick.pham-mwp created

    hi @liangshiwei i have got it working now. Thank you very much for your kind help for the last few days. Much appreciated.

    Nick

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