Base solution for your next web application
Open Closed

Problems when uploading data to backend #4813


User avatar
0
abdourahmani created

Hi,

My application (v.5.1.0 angular + aspnet.core) gets its data from reports produced by other applications. I parse these reports using XlsxJs or Papaparse into arrays of json records.

Then I send this data to the backend service using

this._AtmService.loadAtmTransInput(data, this.initDb).subscribe(
                // process Ok => next
                () => {
                    this.notifyProgressBar();
                    this.progress.incrementLoading();
                    resolve();
                },
                // process error => Error
                () => {
                    this.notifyProgressBar();
                    this.progress.incrementLoading();
                }
            );

"loadAtmTransInput" is imported this way

import { AtmTransServiceProxy, AtmTransDto } from 'shared/service-proxies/service-proxies';

.

Here is my backend service :

public class AtmTransAppService : RapproDabAppServiceBase, IAtmTransAppService
    {
        private readonly IImportDataManager<AtmTrans, long, AtmTransDto> _importManager;

        public AtmTransAppService(IImportDataManager<AtmTrans, long, AtmTransDto> importManager)
        {
            _importManager = importManager;
            _importManager.TableName = "AtmTrans";
            _importManager.KeyToUpdate = AppSettings.AppBusinessManagement.AtmTransactionsRead;
        }

        public void LoadAtmTransInput(List<AtmTransDto> input, bool init)
        {
            _importManager
                .LoadDataInput(input);
        }

        public void InitDbTable(bool init)
        {
            _importManager
                .InitDbTable(init);
        }
    }

Things went fine until I deployed to production.

Now I'm getting errors : [attachment=1:9elqo3c9]an error has occured.png[/attachment:9elqo3c9]

in the browse console : [attachment=0:9elqo3c9]No access control.png[/attachment:9elqo3c9]

I don't have errors in the log file. A daily upload consist of 40 files of 1 MB of size (5000 records) each. And files are processed one by one.

My questions are : 1 - Is this the right way to do it ? 2 - If I save the formated json records in files, How can I upload them (mainly, how to receive files in the backend) 3 - Saving to SQL Server takes too long, how can I improve this part of the process.

Any clue to overcome these problems is welcome.

Best regards,

Abdourahmani


2 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @abdourahmani,

    I think your main problem is related to app service's input is not valid. You can chang your app service input like below and try to use it like that, so you can easily understand which input is not send to server correctly.

    public class LoadAtmTransInputDto {
    
    	public List<AtmTransDto> input {get;set;}
    
    	public bool init {get;set;}
    }
    

    If you are concerned about the performance, I suggest you to use sql directly (a stored procedure or executing a raw sql query) in a custom repository (<a class="postlink" href="https://aspnetboilerplate.com/Pages/Documents/Repositories#custom-repositories">https://aspnetboilerplate.com/Pages/Doc ... positories</a>).

  • User Avatar
    0
    abdourahmani created

    Hi @ismcagdas,

    Thanks, I'll give it a try this way

    Abdourahmani