Open Closed

possible problem in web.host #10600


0
murphymj5209 created

I get he below break when I am starting my web.hosts for version 10.4. Please let me know what I am doing incorrectly. thanks.


6 Answer(s)
  • 0
    ismcagdas created
    Support Team

    Hi @murphymj5209

    Is this a new 10.4 project or did you upgrade your project to 10.4 ?

    Thanks,

  • 0
    murphymj5209 created

    this is a new project

  • 0
    ismcagdas created
    Support Team

    Hi @murphymj5209

    We couldn't reproduce the problem, could you share the entire class definition ?

    Thanks,

  • 0
    murphymj5209 created

    using System; using System.Diagnostics; using Abp.Configuration; using Abp.Dependency; using Abp.Domain.Repositories; using Abp.Threading; using Abp.Threading.BackgroundWorkers; using Abp.Threading.Timers; using Abp.Timing; using Mortho.Authorization.Users; using Mortho.Configuration;

    namespace Mortho.MultiTenancy { public class SubscriptionExpireEmailNotifierWorker : PeriodicBackgroundWorkerBase, ISingletonDependency { private const int CheckPeriodAsMilliseconds = 1 * 60 * 60 * 1000 * 24; //1 day

        private readonly IRepository<Tenant> _tenantRepository;
        private readonly UserEmailer _userEmailer;
    
        public SubscriptionExpireEmailNotifierWorker(
            AbpTimer timer,
            IRepository<Tenant> tenantRepository,
            UserEmailer userEmailer) : base(timer)
        {
            _tenantRepository = tenantRepository;
            _userEmailer = userEmailer;
    
            Timer.Period = CheckPeriodAsMilliseconds;
            Timer.RunOnStart = true;
    
            LocalizationSourceName = MorthoConsts.LocalizationSourceName;
        }
    
        protected override void DoWork()
        {
            var subscriptionRemainingDayCount = Convert.ToInt32(SettingManager.GetSettingValueForApplication(AppSettings.TenantManagement.SubscriptionExpireNotifyDayCount));
            var dateToCheckRemainingDayCount = Clock.Now.AddDays(subscriptionRemainingDayCount).ToUniversalTime();
    
            var subscriptionExpiredTenants = _tenantRepository.GetAllList(
                tenant => tenant.SubscriptionEndDateUtc != null &&
                          tenant.SubscriptionEndDateUtc.Value.Date == dateToCheckRemainingDayCount.Date &&
                          tenant.IsActive &&
                          tenant.EditionId != null
            );
    
            foreach (var tenant in subscriptionExpiredTenants)
            {
                Debug.Assert(tenant.EditionId.HasValue);
                try
                {
                    AsyncHelper.RunSync(() => _userEmailer.TryToSendSubscriptionExpiringSoonEmail(tenant.Id, dateToCheckRemainingDayCount));
                }
                catch (Exception exception)
                {
                    Logger.Error(exception.Message, exception);
                }
            }
        }
    }
    

    }

  • 0
    ismcagdas created
    Support Team

    Hi,

    As you can see, the content is different in 10.4 version https://github.com/aspnetzero/aspnet-zero-core/blob/rel-10.4/aspnet-core/src/MyCompanyName.AbpZeroTemplate.Core/MultiTenancy/SubscriptionExpireEmailNotifierWorker.cs#L43.

    You need to use _unitOfWorkManager.WithUnitOfWork in this class.

  • 0
    murphymj5209 created

    I am closing this ticket because I have moved onto 10.5 release