Base solution for your next web application

Activities of "paul lee"

Hi All,

Ok, I have re-read the documentation page and kinda missed the injecting the ISettingManager to my BackgroundWorker and from the constructor I can then assigned it to the property exposed by BackgroundWorkerBase base class.

However, I read on top of the documentation page that I need to implement ISettingStore before the settings will be read from database. It also talked about Module Zero already implemented this.

So, in my project I am also using Module Zero, then do I need to implement ISettingStore or I can just used the implementation from Module Zero?

Would be great if someone can point me to the right direction.

Thank you very much.

Paul

Hi All,

I am trying to add a Background Worker that will be executed according to a schedule, I am using HangFire integration.

Inside this BackgroundWorker I need to get some settings from DB, I am using the Setting infrastructure build into Abp. However, I couldn't seems to get the SettingManager populated and it is always null.

I have followed the Documentation:

  1. I have defined a new namespace: MyApp.Configuration in Core module. Inside this namespace there are 2 new classes, MyAppSettingsProvider and MyAppSettingNames.

  2. Since the Backgound Worker will be used in the Web module I have added the following to WebModule class in the PreInitialize() method:

public override void PreInitialize()
    {
      //Enable database based localization
      // Configuration.Modules.Zero().LanguageManagement.EnableDbLocalization();
      Configuration.Localization.Languages.Add(new LanguageInfo("en", "English", "famfamfam-flag-england", true));

      .....

      Configuration.Settings.Providers.Add<MyAppSettingsProvider>();

      Configuration.BackgroundJobs.UseHangfire(configuration =>
      {
        configuration.GlobalConfiguration.UseSqlServerStorage("Default");
      });
    }
  1. I am reading the setting during the constructor of the background worker, but I am getting Null Reference Exception:
public class MyPassiveWorker : PeriodicBackgroundWorkerBase, ISingletonDependency
  {
    private readonly string _workingPath;

    public MyPassiveWorker(AbpTimer timer) : base(timer)
    {
      _workingPath = SettingManager.GetSettingValue(MyAppSettingNames.FuntionName_WorkingDirectory);
      Timer.Period = 60000;
    }

I tried to debug into the SettingManager.GetSettingValue.... line and SettingManager is always null. So what am I missing?

Thanks you very much.

Paul

Thanks daws, you are the man.

I have got it running and I am using the Console App route for now. Might want to move onto Windows Service later.

Thank you very much.

After some reading up on SO, I now understand that sending the file as a response of an ajax request is not possible. So I now want to try something like this:

  1. When the user wants to export some data to PDF, I use ApplicationService to Enqueue the document generation job in Hangfire. I am using SQL Storage for jobs.

  2. Inside the Background Job it will retrieve all the data (job control and related data from DB) then go off and generate the document. Finally it saves the file in a folder on the server.

  3. There should be something to keep polling the Job status(but I am not sure what?), when the job status changed to READY, it then sends a SignalR message to client (download URL inside the message payload)

  4. When the client received the message, it will trigger a File Download action to download the file from server.

What I have tried now:

  1. I have the ApplicationService successfully enqueued job in both local and remote Hangfire server, I have verified this with the use of Hangfire dashboard

  2. I have also have the Background job to successfully generate, store the file to a specific folder and updated the job status to READY in DB. I have verified this by running sql queries to check the data records.

  3. I am stuck on this point, I am not sure will the polling of job status be done in the Hub or using another recurring job or should the Hangfire Job asks the Hub to send a message to the specific user at the end of the Background job execution?

  4. I have done a MVC controller with FileStreamActionResult ready for accepting the download requests from the clients.

So what am I missing?

Thanks.

Yes, both classes are in the Core project. The same setup as one of your wonderful samples. However, I can't get it to work.

Hi there,

Have you checked if you have the Web project set as start-up project?

Have you checked in the App.config or Web.config in the start-up project having the correct connection strings, userId and Password? Also please check if you are connecting to the correct database.

Paul

Hi all,

Does anyone knows or have links to samples or tutorials about how to send files to client from the ApplicationServices?

Do I just sent the encoded byte array in an OutputDTO?

Thanks.

Hi All,

I am following BackgroundJobAndNotificationDemo from Abp.Samples to try to get this document generation background job working.

I have a BackgroundJob defined as follows and following the sample project, this class lives in the Core module:

public class ExcelGenerationJob : BackgroundJob<ExcelGenerationJobArgs>, ITransientDependency
{
  // Some other code....

  public ExcelGenerationJob()
  {
    LocalizationSourceName = ProjectConsts.LocalizationSourceName;
  }

  // However, I get whatever string I passed to L() back here 
  public void ComposeAdText()
  {
    var stringBuilder = new StringBuilder();
    stringBuilder.AppendLine(L("AdTextLine1"));
    
    // Here in the Log I always see AdTextLine1 being attached to the log line...
    Logger.Debug("Localizing AdTextLine1 - " + stringBuilder.ToString()); 
  }
}

I tried to debug a bit and see that base.LocalizationManager.GetAllSources().Count is always 0. So what's the proper way to initialize Localization to get this working?

Thanks.

Hi all,

I am very very new to Hangfire (I just know it is used to run jobs in the background) and this will be my first contact with it so please bear with me.

I am in the middle of a project where I need to generate some report and data export files in Excel and PDF. But our web server is quite busy so I need to off-load this document generation process to some other servers. I have read up on Hangfire's overview page that this can be configured as "Separate Server".

I can not vision how this is possible with Abp + Hangfire, can someone kindly explain generally how this can be done?

Thank you very much. Paul

Hi,

I am on the same boat as the OP and due to the limitations in my organisation, it is not possible for me to update the .NET framework version to v4.6.1 as required by Abp v0.8.0.1.

In the mean-time I tried to download the source of Abp-master and recompile to target 4.5.2, however, I am getting a lot of errors and not sure how to proceed further.

So how can anyone that are stuck with .NET framework v4.5.2, still be able to deploy Abp successfully?

  1. Are there any back version which are not too different in feature that supports v4.5.2?
  2. Are there specific instructions to recompile Abp to target v4.5.2?
  3. How long or how much effort will be involved to add support for targeting at lease the 4.5 and 4.6 series of .NET?

-- Edit to add one more idea 4. Is it possible to make available a feature on the website that can generate templates that are based on Abp v0.7.8.0? -- End Edit

I have opened an issue as suggested by hikalkan on GitHub.

Thank you

Showing 1 to 10 of 17 entries