Base solution for your next web application

Activities of "pankajmathur"

Question

Hi,

I am using Hangfire for background job.

public override void Execute(GeneratePayloadAndSendToMobileArgs generatePayloadAndSendToMobileArgs)
        {

            Task SendDataToMobileTask = Task.Run(() => SendDataToMobile(generatePayloadAndSendToMobileArgs));
            SendDataToMobileTask.Wait();
        }

private async Task SendDataToMobile(GeneratePayloadAndSendToMobileArgs generatePayloadAndSendToMobileArgs)
        {
            try
            {
                using (_abpSession.Use(generatePayloadAndSendToMobileArgs.TenantId, generatePayloadAndSendToMobileArgs.UserId))
                {
                    using (var unitOfWork = _unitOfWorkManager.Begin())
                    {
                        Dictionary<RetailObjectId, ICRUDAppService> CRUDAppServices = new Dictionary<RetailObjectId, ICRUDAppService>();
                        List<PayloadData> PayloadsToSend = new List<PayloadData>();
                        Dictionary<long, string> PayloadsToSave = new Dictionary<long, string>();

                        var Payloads = (from Rep in _ReplicationTransactionMobileRepository.GetAll()
                                        select new
                                        {
                                            SequenceNo = Rep.Id,
                                            SourceType = (RetailObjectId)Rep.SourceType,
                                            SourceKey = Rep.SourceKey,
                                            OperationType = (OperationType)Rep.OperationType,
                                            Payload = Rep.Payload,

                                        }).ToList().Take(500);



                        foreach (var item in Payloads)
                        {
                            PayloadData PayloadToSend = new PayloadData()
                            {
                                SequenceNo = item.SequenceNo,
                                SourceType = item.SourceType,
                                SourceKey = item.SourceKey,
                                OperationType = item.OperationType,
                            };

                            if (!string.IsNullOrEmpty(item.Payload))
                                PayloadToSend.Payload = GetPayload(item.SourceType, item.Payload);
                            else
                            {
                                string PayloadToSave = GeneratePayload(item.SequenceNo, item.SourceType, item.SourceKey, CRUDAppServices);
                                PayloadToSend.Payload = GetPayload(item.SourceType, PayloadToSave);
                                PayloadsToSave.Add(item.SequenceNo, PayloadToSave);
                            }

                            PayloadsToSend.Add(PayloadToSend);
                            PayloadResult obj = new PayloadResult();
                            obj.result = PayloadsToSend;


                            List<ConnectedClient> connectedClients = AppStatic.ConnectedClients.Where(p => p.TenantId == generatePayloadAndSendToMobileArgs.TenantId).ToList();
                            if (connectedClients.Count() > 0 && PayloadsToSend.Count > 0)
                            {
                                JsonSerializerSettings jsonSerializerSettings = new JsonSerializerSettings();
                                jsonSerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
                                await _iVend365HubContext.Clients.All.SendAsync("GetDeltaQueue", JsonConvert.SerializeObject(obj, jsonSerializerSettings));

                            }
                        }

                        //Delete the Successfully send records
                        _iVendRepository.ExecuteQuery("Delete From RepReplicationTransactionMobileDetail Where ProcessStatus = 1");
                        _iVendRepository.ExecuteQuery("Delete From RepReplicationTransactionMobile Where SequenceNo Not In (Select RepReplicationTransactionMobileSequenceNo From RepReplicationTransactionMobileDetail)");

                        //Save the newely generated Payload in DB
                        foreach (KeyValuePair<long, string> PayloadToSave in PayloadsToSave)
                        {
                            ReplicationTransactionMobile replicationTransactionMobile = _ReplicationTransactionMobileRepository.Get(PayloadToSave.Key);
                            replicationTransactionMobile.Payload = PayloadToSave.Value;
                            _ReplicationTransactionMobileRepository.Update(replicationTransactionMobile);
                        }


                        unitOfWork.Complete();

                    }
                }
            }
            catch (Exception ex)
            {

            }

        }

In the above code, at following line, it throws the error, "There is already an open DataReader associated with this Command which must be closed first." Any idea, what could be wrong here?

var Payloads = (from Rep in _ReplicationTransactionMobileRepository.GetAll()
                                        select new
                                        {
                                            SequenceNo = Rep.Id,
                                            SourceType = (RetailObjectId)Rep.SourceType,
                                            SourceKey = Rep.SourceKey,
                                            OperationType = (OperationType)Rep.OperationType,
                                            Payload = Rep.Payload,

                                        }).ToList().Take(500);
Answer

Hi,

Please ignore this post...It was my mistake.....solved now....

Question

Hi,

I have downloaded the sample oData project from <a class="postlink" href="https://github.com/aspnetboilerplate/sample-odata">https://github.com/aspnetboilerplate/sample-odata</a> I re-stored all the nuget packages.

Now when I run the Update-Database command from package manager console, it throws the following error:

No migrations configuration type was found in the assembly 'AbpODataDemo.EntityFramework'. (In Visual Studio you can use the Enable-Migrations command from Package Manager Console to add a migrations configuration).

Please advise....

Question

Hi,

We have recently upgraded the ABP to version 3.7.2. through Nuget. We are facing a strange issue even at localhost. (and same at azure)

Issue


If one of my page remains open for quite some time (not exactly sure how long) then if I press F5 to refresh the page, we receive 500 error. In the network tab of chrome developer tool, we saw that pressing F5 does not even send a request to the server.

What is the workaround currently


We saw following two workarounds to overcome the above unresponsive situation:

  1. Close the chrome completely (I mean not just the tab of chrome, rather entire chrome window).
  2. Don't close the chrome, rather simply delete the cookie called "AspNetCore.Identity.Application".

Could you please advice what is going wrong here, so that we don't have to do any workaround.

Answer

Hi, If you read my issue carefully, even pressing F5 does not show any request sent in the Network tab of chrome developer tool. since, it is not sending request to server, there is nothing recorded in the log.

Question

Hi,

We were running ABP Zero (JQuery version) having ABP Version 3.6.2. There was some out of memory exception and we thought better to upgrade to ABP 3.7.2 so we did that. After upgrade to 3.7.2, we started facing a strange following issue.

Issue


At any point of time any page becomes unresponsive and give 500 error. In the network tab of chrome developer tool, we saw that pressing F5 does not even send a request to the server. After doing analysis, we found following two workarounds to resolves the issue.

  1. Close the chrome completely (I mean not just the opened tab of chrome, rather entire chrome window).
  2. Don't close the chrome, rather simply delete the cookie called "AspNetCore.Identity.Application".

To avoid above unresponsive we thought better to rollback to ABP Version 3.6.2. We did that but now on every page we get "An Internal Error" and this error is at the following line of code.

Class - NotificationAppService.cs Method - public async Task<GetNotificationsOutput> GetUserNotifications(GetUserNotificationsInput input)

In the above method, it successfully executes to get the totalCount and unreadCount. But when it tries to execute the next line that is var notifications = await _userNotificationManager.GetUserNotificationsAsync( AbpSession.ToUserIdentifier(), input.State, input.SkipCount, input.MaxResultCount );

it throws some exception related to something like assembly 3.7.2 not found. We are surprised when we already rolled back to 3.6.2 why in the above line it is somehow referring to 3.7.2

Please help by either resolving the unresponsiveness issue in 3.7.2 Or help to fix the notification issue in 3.6.2....

We are badly stuck.

Regards, Mahendra

Answer

We are using JQuery Version. Also there is no definite time to be specific. And irrespective whether the page left idle for sometime or you continue working on the page. After some time it becomes unresponsive.

Also what I have noted is prior to upgrade, in the localhost if you are logged in once and then close the browser and reopen the localhost, it does not show you the login screen and you are straight away in to the application.

But after upgrade, each time I run localhost it asks for login.

Regards, Mahendra

Answer

Can somebody please help. I am again putting my issue.

After ABP Upgrade to 3.7.2 from 3.6.2, my application page (any page) after some time (irrespective I am continuously working or left the page idle), becomes unresponsive. When I see the developer tool, it seems that once page becomes unresponsive, the F5 (Refresh), does not send any request to the server. If I delete the cookie, "AspNetCore.Identity.Application" and then press F5, it throws me to the login screen.....

Please help Regards, Mahendra

Answer

Hi,

The ABP, we upgrade is simply upgrading the Nuget packages. Is there an easy way to upgrade the ASPNet Zero. Or the only way to upgrade ASPNet Zero is to download the latest version of ASPNet Zero and do a file merging. If this the way....do you think would it be an easy to upgrade?

Or, if there is an easy way to upgrade, please do let us know....

Regards, Mahendra

Answer

It's not that easy for me now. Again, please try to understand, I am not using IdentityServer. Still, after sometime the page goes unresposive...

Would it be possible for someone to come on a online session with me and check quickly what could be wrong.

Regards, Mahendra

Showing 111 to 120 of 123 entries