Base solution for your next web application

Activities of "hozkar"

Hi,

Im trying to create a RecurringJob with Hangfire but i dont know what should be the correct approach to achieve this.

I'm trying to define my Recurring Jobs in the Postinitialize Method of my Web Module:

var clientDomainService = IocManager.Resolve<ClientDomainService>();
RecurringJob.AddOrUpdate(() => clientDomainService.NotifyAppointment(), Cron.Minutely);

ClientDomainService inherits form DomainServiceBase, but when the recurring job executes, I got a NullReferenceException when executing this line (CurrentUnitOfWork is null):

using (CurrentUnitOfWork.DisableFilter(AbpDataFilters.MayHaveTenant))

After that, i decided to manually inject a IUnitOfWork in my domain service by its constructor, and it works; but now i noticed that i'm not able to navigate throw my entities foreign key properties: I received the following error:

Additional information: The ObjectContext instance has been disposed and can no longer be used for operations that require a connection.

So, to continue with my tests i decided to include my navigation properties in the result of my repository query, but the problem now is when I query Users in the userManager i received the following exception:

Additional information: The operation cannot be completed because the DbContext has been disposed.

Could you guys please help me and tell me what is the correct approach to use my domain services methods in a recurring job?

Thanks in advance.

Thank you very much for the information! I was having the same problem.

I finally managed to find the issue and it was something on my side. During the creation of each tenant I am seeding some data synchronously and that process is taking too long. Maybe some configuration in the Azure side is cutting the connection to the database for those long processes.

I commented out that part and the tenant was created instantly. Thanks for your help!

Uploading image

Good day,

Thanks for your answer, I'm including the image again (also from Azure). My tenants are not creating different database, they all share the same.

I am trying to create a tenant after deploying my ASP.NET Zero application to an Azure App Service instance. When I try to create it I get a backend error as shown in the image:

I deployed two app service instances and in the first one I managed to create a tenant after several attempts and errors, but in the second instance (staging) I have not been able to create it.

In my development environment (Visual Studio 2015) tenants are created with no issues.

Thanks in advance.

Good day, hikalkan

I will rename my services to AppService. It took me quite a while to realize what the issue was.

Thanks a lot for the solution and the advise.

Good day hikalkan,

You are right, solution projects were in v0.11.0.2. but test project was in v0.10.3.1. I updated it and they all passed.

Thanks a lot for your quick and accurate answer.

Good day, hikalkan

Thanks for your quick answer. I'm using v0.11.0.2.

I did as you said but the failing tests persists. I think the problem is that the Logger dependency is not being injected into the tests classes because other tests that aren't related to the application services run successfully (ConnectionString and PasswordComplexity). The solution runs normally as well.

I'm trying to add testing to my project but when I run the default unit tests (from Zero) I got the following error in all of the tests related to application services:

Test Name: Bow.Tests.Organizations.OrganizationUnitAppService_Tests.Test_CreateOrganizationUnit Test FullName: Bow.Tests.Organizations.OrganizationUnitAppService_Tests.Test_CreateOrganizationUnit Test Source: C:\Users\Darwin\Source\Repos\BowZero\Tests\Bow.Tests\Organizations\OrganizationUnitAppService_Tests.cs : line 53 Test Outcome: Failed Test Duration: 0:00:00,001

Result StackTrace: en Abp.AutoMapper.AbpAutoMapperModule.FindAndAutoMapTypes(IMapperConfigurationExpression configuration) en Abp.AutoMapper.AbpAutoMapperModule.<CreateMappings>b__6_0(IMapperConfigurationExpression configuration) en D:\Halil\GitHub\aspnetboilerplate\src\Abp.AutoMapper\AutoMapper\AbpAutoMapperModule.cs:línea 55 en AutoMapper.MapperConfiguration.Build(Action1 configure) en AutoMapper.Mapper.Initialize(Action1 config) en Abp.AutoMapper.AbpAutoMapperModule.CreateMappings() en D:\Halil\GitHub\aspnetboilerplate\src\Abp.AutoMapper\AutoMapper\AbpAutoMapperModule.cs:línea 53 en Abp.AutoMapper.AbpAutoMapperModule.PostInitialize() en D:\Halil\GitHub\aspnetboilerplate\src\Abp.AutoMapper\AutoMapper\AbpAutoMapperModule.cs:línea 36 en Abp.Modules.AbpModuleManager.<>c.<StartModules>b__16_2(AbpModuleInfo module) en D:\Halil\GitHub\aspnetboilerplate\src\Abp\Modules\AbpModuleManager.cs:línea 49 en System.Collections.Generic.List1.ForEach(Action1 action) en Abp.Modules.AbpModuleManager.StartModules() en D:\Halil\GitHub\aspnetboilerplate\src\Abp\Modules\AbpModuleManager.cs:línea 49 en Abp.AbpBootstrapper.Initialize() en D:\Halil\GitHub\aspnetboilerplate\src\Abp\AbpBootstrapper.cs:línea 138 en Abp.TestBase.AbpIntegratedTestBase1.InitializeAbp() en D:\Halil\GitHub\aspnetboilerplate\src\Abp.TestBase\TestBase\AbpIntegratedTestBase.cs:línea 42 en Abp.TestBase.AbpIntegratedTestBase1..ctor(Boolean initializeAbp) en D:\Halil\GitHub\aspnetboilerplate\src\Abp.TestBase\TestBase\AbpIntegratedTestBase.cs:línea 34 en Bow.Tests.AppTestBase..ctor() en C:\Users\Darwin\Source\Repos\BowZero\Tests\Bow.Tests\AppTestBase.cs:línea 36 en Bow.Tests.Organizations.OrganizationUnitAppService_Tests..ctor() en C:\Users\Darwin\Source\Repos\BowZero\Tests\Bow.Tests\Organizations\OrganizationUnitAppService_Tests.cs:línea 19 Result Message: System.MissingMethodException : Método no encontrado: 'Castle.Core.Logging.ILogger Abp.Modules.AbpModule.get_Logger()'.

Showing 11 to 20 of 28 entries