I’m trying to call the DocumentService from the InvoiceService and have been following this guide: https://abp.io/docs/latest/guides/synchronous-interservice-communication I suspect that some parts of the guide are either incorrect or outdated — especially the module dependency part referencing typeof(ProductServiceHttpApiClientModule), which I can’t find in our solution. Could it actually refer to ProductServiceContractsModule instead? Anyway, I’m getting an error in the deployment logs in the InvoiceService (seems that DocumentService endpoints are not found?):
[20:29:57 INF] Found 2 events in the inbox.
[20:29:57 ERR] An exception was thrown while activating InvoiceService.TicketCompletedEventHandler -> Castle.Proxies.InvoiceManagerProxy.
Autofac.Core.DependencyResolutionException: An exception was thrown while activating InvoiceService.TicketCompletedEventHandler -> Castle.Proxies.InvoiceManagerProxy.
---> Autofac.Core.DependencyResolutionException: None of the constructors found on type 'Castle.Proxies.InvoiceManagerProxy' can be invoked with the available services and parameters:
Cannot resolve parameter 'DocumentService.Documents.IDocumentsAppService documentsAppService' of constructor 'Void .ctor(Castle.DynamicProxy.IInterceptor[], InvoiceService.Invoices.IInvoiceRepository, InvoiceService.Resources.IResourceRepository, InvoiceService.Customers.ICustomerRepository, InvoiceService.Invoices.IInvoiceResourceRepository, InvoiceService.PlaceOfPayments.IPlaceOfPaymentRepository, Volo.Abp.EventBus.Distributed.IDistributedEventBus, Volo.Abp.Data.IDataFilter, DocumentService.Documents.IDocumentsAppService, Microsoft.Extensions.Logging.ILogger`1[InvoiceService.Invoices.InvoiceManager])'.
See https://autofac.rtfd.io/help/no-constructors-bindable for more info.
at Autofac.Core.Activators.Reflection.ReflectionActivator.<>c__DisplayClass14_0.<UseSingleConstructorActivation>b__0(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Middleware.DisposalTrackingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
at Autofac.Builder.RegistrationBuilder`3.<>c__DisplayClass41_0.<PropertiesAutowired>b__0(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
--- End of inner exception stack trace ---
at Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Middleware.SharingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Middleware.CircularDependencyDetectorMiddleware.Execute(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, ResolveRequest& request)
at Autofac.Core.Resolving.ResolveOperation.ExecuteOperation(ResolveRequest& request)
at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance)
at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
at Volo.Abp.EventBus.IocEventHandlerFactory.GetHandler()
at Volo.Abp.EventBus.EventBusBase.TriggerHandlerAsync(IEventHandlerFactory asyncHandlerFactory, Type eventType, Object eventData, List`1 exceptions, InboxConfig inboxConfig)
at Volo.Abp.EventBus.EventBusBase.TriggerHandlersAsync(Type eventType, Object eventData, List`1 exceptions, InboxConfig inboxConfig)
at Volo.Abp.EventBus.Distributed.DistributedEventBusBase.TriggerHandlersFromInboxAsync(Type eventType, Object eventData, List`1 exceptions, InboxConfig inboxConfig)
at Volo.Abp.EventBus.RabbitMq.RabbitMqDistributedEventBus.ProcessFromInboxAsync(IncomingEventInfo incomingEvent, InboxConfig inboxConfig)
at Volo.Abp.EventBus.Distributed.InboxProcessor.RunAsync()
at Volo.Abp.EventBus.Distributed.InboxProcessor.RunAsync()
at Volo.Abp.EventBus.Distributed.InboxProcessor.TimerOnElapsed(AbpAsyncTimer arg)
at Volo.Abp.Threading.AbpAsyncTimer.Timer_Elapsed()
[20:29:57 ERR] ---------- Exception Data ----------
ActivatorChain = InvoiceService.TicketCompletedEventHandler -> Castle.Proxies.InvoiceManagerProxy
Do you have any tips or ideas about what might be causing this issue? Best regards
3 Answer(s)
-
0
To enable synchronous communication between services in ABP (such as calling DocumentService from InvoiceService), you must reference the correct modules and configure dependencies as described in the official guide.
Based on your error, the problem is that the dependency injection system cannot resolve the IDocumentsAppService in your InvoiceManager. This typically means the HttpApi.Client module for DocumentService is not referenced or registered properly in InvoiceService.
Here is the correct approach, following the official documentation:
- Reference the HttpApi.Client Project
- In your InvoiceService.Application (or equivalent) project, add a reference to the DocumentService.HttpApi.Client project:
<ProjectReference Include="..\..\..\document\src\DocumentService.HttpApi.Client\DocumentService.HttpApi.Client.csproj" />
- Add Module Dependency
- In your InvoiceServiceApplicationModule, add a dependency on the DocumentServiceHttpApiClientModule:
[DependsOn( typeof(DocumentServiceHttpApiClientModule) )] public class InvoiceServiceApplicationModule : AbpModule { // ... }
- The guide's reference to
ProductServiceHttpApiClientModule
is just an example. You should use the actual module class from your DocumentService.HttpApi.Client project, which is typically namedDocumentServiceHttpApiClientModule
.
- Configure Remote Service Endpoints
- In your InvoiceService.HttpApi.Host's
appsettings.json
, configure the remote service endpoint for DocumentService:
- In your InvoiceService.HttpApi.Host's
"RemoteServices": { "Default": { "BaseUrl": "https://your-document-service-url/" } }
Do Not Use Contracts Module for Remote Calls
- The Contracts module (
DocumentServiceContractsModule
) is for sharing DTOs and interfaces, not for enabling remote HTTP calls. You must use the HttpApi.Client module for remote service proxies.
- The Contracts module (
Rebuild and Restart
- After making these changes, rebuild your solution and restart the services.
If you follow these steps and ensure the correct module is referenced and registered, the DI system will be able to resolve
IDocumentsAppService
as a dynamic HTTP proxy, and your error should be resolved.Sources:
This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.
- Reference the HttpApi.Client Project
-
0
I dont have any DocumentService.HttpApi.Client project. Only DocumentService, and since we are using multiple repos (InvoiceService and DocumentService are separated in different Git repos), we would rather not include the DocuemntService code in the InvoiceSerivce repo.
Best regards,
-
0
hi
Could you share some code to help us understand your case?
You can use
Static C# API Client Proxies
between your services.https://abp.io/docs/latest/framework/api-development/static-csharp-clients?_redirected=B8ABF606AA1BDF5C629883DF1061649A
Thanks.