Last post Oct 27, 2017 12:36 PM by tgirgenti
Oct 26, 2017 08:00 PM|TGirgenti|LINK
I have a .Net 4.5.1, ASP.Net, MVC 5, web application that uses SignalR 2.2.2 to display progress update to a client screen during an Excel import to database.
Once I click the Import button on the client screen, it runs a server program to read an excel file with 500 rows and each row is a different product that is imported to an Sql database table.
I use SignalR 2.2.2 with a hub proxy method to display update messages to the client screen indicating which product it is importing. It displays a message like "Product count: 117". The variable that holds the count value is very simple:
int productCount = 0;
productCount += 1;
MyProgressReporting(productCount, product.Sku, product.Name);
When it displays the "Product count:", it starts out at 1, but after a while, it starts to display very strangely.
It displays "Product count: 117". Then it displays "Product count: 112". Then it displays "Product count: 118". Then it displays "Product count: 113". Then it displays "Product count: 119". Then it displays "Product count: 114". Then it
displays "Product count: 120".
You can see that it changes the count, but it displays a previous count then a it displays a later count. When it finally gets to 500, it finishes displaying the previous counts until it gets to 500 again and the program finally ends.
Sometimes the gap in the difference of counts gets up to 30 and it seems to be different every time I run the program.
I searched my program and the only references to productCount are as I indicated previously.
Can anyone explain why I'm getting this strange behavior with the displays by SignalR?
Oct 27, 2017 02:04 AM|Jean Sun|LINK
It displays "Product count: 117". Then it displays "Product count: 112". Then it displays "Product count: 118". Then it displays "Product count: 113". Then it displays "Product count: 119". Then it displays "Product count: 114". Then it displays
"Product count: 120".
It seems that you uploaded the excel multiple times, so the progresses of multiple uploaded all show in one progress bar. So sometime it show the progress1's count number, sometimes it show the progress2's count number. Which will lead to the strange behavior.
Could you please share your code here? It will be helpful to figure out the reason when we have the code.
And several days ago, I made a demo about the multiple progress bar, you can take it as reference.
Oct 27, 2017 12:36 PM|TGirgenti|LINK
Thanks for your help.
Your reply caused me to think about when I start my import process, I found that I was clicking the import button twice to get it started. The first click did not do anything because I did not wait long enough for the import to start. So, clicking it twice
probably caused two separate processes to start and that is why I was seeing those unusual displays.
So, now I only click it once and give it time to get started and I don't see that strange display behavior.