أنشطة "dan@dancaron.com"

إجابة

Ok that got me close. I'm very close to solving this. The example you provided is more for a worker process than for an isolated azure function v4 in .net 7, but it's useful and I'm almost there. I am now able to initialize the ABP app. But I get an error when I call...

_abpApplication.ServiceProvider.GetRequiredService<myAppService>();

I'm getting the following error:

Autofac.Core.Registration.ComponentNotRegisteredException: 'The requested service 'Volo.Abp.Castle.DynamicProxy.AbpAsyncDeterminationInterceptor`1[[Volo.Abp.Uow.UnitOfWorkInterceptor, Volo.Abp.Uow, Version=7.1.0.0, Culture=neutral, PublicKeyToken=null]]' has not been registered. To avoid this exception, either register a component to provide the service, check for service registration using IsRegistered(), or use the ResolveOptional() method to resolve an optional dependency.'

إجابة

The example in ConsoleTestApp creates an instance of ClientDemoService and then executes RunAsync() method. I could get that working OK within the Azure Function.

However, the problem is that in an Azure Function program.cs, you're not creating an instance of a class and executing a method in the way that it's done in the ConsoleTestApp. Instead, you're working with HostBuilder and calling Host.Run(). The methods that get called and the instantiation of the class is not done explicitly in program.cs, rather it's instantiated by the worker process (it's invoked automatically when an item is found in the Azure storage queue). So it's a very different pattern than ConsoleTestApp.

The problem, I think, has to do with dependency injection. If I don't inject the HttpApi Client App Service class, then it can't resolve it (so that is the error that I see). I can clear up that error by injecting that class in program.cs, but the moment I try to inject that class, then the worker process never instantiates my "queue processor" class - meaning it just silently fails - nothing logged. My best guess is possibly that I need to inject dependencies of the ABP HttpApi Client app service class. But I am hoping you can point me to a working example - or even to someone who's done this before.

Thanks,

Dan

إجابة

Ahhhh I imagine that is the problem. Ok, I am new to ABP and I had assumed that the ABP Suite modules screen would only present options that are valid for my solution. I had not thought through IdentityServer vs. OpenIddict as I have not used either of them before. Thank you.

عرض 1 الي 3 من 3 إدخالات
Made with ❤️ on ABP v8.2.0-preview Updated on مارس 25, 2024, 15:11