Click here to Skip to main content
15,921,542 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: asp.net related question Pin
Tom Marvolo Riddle10-Mar-14 23:36
professionalTom Marvolo Riddle10-Mar-14 23:36 
QuestionSingle Login page for multiple applications. Pin
HemadriT10-Mar-14 10:21
HemadriT10-Mar-14 10:21 
AnswerRe: Single Login page for multiple applications. Pin
RaghuPT11-Mar-14 1:55
RaghuPT11-Mar-14 1:55 
GeneralRe: Single Login page for multiple applications. Pin
HemadriT11-Mar-14 3:52
HemadriT11-Mar-14 3:52 
GeneralRe: Single Login page for multiple applications. Pin
HemadriT11-Mar-14 3:58
HemadriT11-Mar-14 3:58 
AnswerRe: Single Login page for multiple applications. Pin
ZurdoDev11-Mar-14 9:51
professionalZurdoDev11-Mar-14 9:51 
GeneralRe: Single Login page for multiple applications. Pin
HemadriT11-Mar-14 10:19
HemadriT11-Mar-14 10:19 
QuestionRe: Single Login page for multiple applications. Pin
ZurdoDev11-Mar-14 10:20
professionalZurdoDev11-Mar-14 10:20 
Questionhow to add datepicker in gridview boundfield column Pin
heena rohra9-Mar-14 22:48
heena rohra9-Mar-14 22:48 
AnswerRe: how to add datepicker in gridview boundfield column Pin
i gr810-Mar-14 0:06
i gr810-Mar-14 0:06 
AnswerRe: how to add datepicker in gridview boundfield column Pin
Jαved10-Mar-14 22:32
professionalJαved10-Mar-14 22:32 
QuestionUrgent help how creating forums with ASP.NET using C# Pin
Samer Wolf9-Mar-14 2:27
Samer Wolf9-Mar-14 2:27 
AnswerRe: Urgent help how creating forums with ASP.NET using C# Pin
Kornfeld Eliyahu Peter9-Mar-14 2:43
professionalKornfeld Eliyahu Peter9-Mar-14 2:43 
AnswerRe: Urgent help how creating forums with ASP.NET using C# Pin
ZurdoDev11-Mar-14 9:52
professionalZurdoDev11-Mar-14 9:52 
QuestionUsing CrystalReport Implement Print Pin
Mr.Roking8-Mar-14 23:13
Mr.Roking8-Mar-14 23:13 
QuestionWhy it is so hard to play with html in visual studio Pin
ankur11638-Mar-14 18:42
ankur11638-Mar-14 18:42 
AnswerRe: Why it is so hard to play with html in visual studio Pin
ankur11638-Mar-14 20:01
ankur11638-Mar-14 20:01 
SuggestionRe: Why it is so hard to play with html in visual studio Pin
Richard MacCutchan8-Mar-14 22:28
mveRichard MacCutchan8-Mar-14 22:28 
AnswerRe: Why it is so hard to play with html in visual studio Pin
Kornfeld Eliyahu Peter8-Mar-14 23:32
professionalKornfeld Eliyahu Peter8-Mar-14 23:32 
AnswerRe: Why it is so hard to play with html in visual studio Pin
jkirkerx10-Mar-14 13:55
professionaljkirkerx10-Mar-14 13:55 
Questionasp.net site taking all the CPU after a while Pin
Amaranth137-Mar-14 8:02
Amaranth137-Mar-14 8:02 
I have a big issue with the asp.net site I did. It's hosted on a server station, with IIS 7, and many clients (around 10) are accessing it. Around twice a week, the site is unacessible. When checking on the server, the CPU is at 100%. Resetting he application pool solves it.

The page has a auto-refresh function to update the products status (with color depending on the status). It fetches informations from other internal sites and Perforce. The refresh is done by a timer and set to 30 seconds.

<pre lang="HTML"><pre><asp:Timer ID="tmrTimer" OnTick="tmrTimer_Tick" Interval="300000" runat="server"></asp:Timer>


When the client select a product, I fill the page with the corresponding information. There is a table with the option runat="server" that I clear and fill with lines containing the information.

I place logs to check what was taking so long, but the total init time of the page is always under 1 second (there is information caching), even if the user has to wait more time than that to see the information.

At first, I thought the refresh was taking too long and that it was launching a new refresh before finishing the first one, so I increased the refresh time to 30 seconds, but it does not seem to be the case (unless the user clicks on another product before the product information finished displaying.

Here is my page initialization logic. It might not be the best way (since I don't have much experience with web programming), but it works. I only need to fix the CPU usage issue that forces us to reboot the server once in a while.

I think it might be caused by some threads working that were not terminated for some reason. I have to make a series of tests next week, but wanted to know in which direction to look or if someone had an idea.

C#
protected void Page_Load(object sender, EventArgs e)
 {
     //Menus are updated here instead of in the page_init because the items.clear
     //did not seem to work when called from page_init
     if (IsPostBack)
     {
         return;
     }
     var d = DateTime.Now;
     UpdateMenus();
     Log.Info("Update menus : " + DateTime.Now.Subtract(d).Milliseconds + " ms");
 }

 protected void Page_Init(object sender, EventArgs e)
 {
     //Variables for logging purposes
     var source = "";
     var t = DateTime.Now;
     var d = DateTime.Now;

     //Fetch the product Id
     SessionSettings.SelectedProductId = Request.QueryString["ProductId"];

     if (!IsPostBack)
     {
         CreateMenusDictionnary();
         SessionSettings.TurnAllDisplayOff();
         Session[CURRENT_BRANCH_KEY] = null;
         Session[CURRENT_SOFTWARE_KEY] = null;
         DisplaySelectedProductInfo();
         source = "(startup)";
         if (!string.IsNullOrEmpty(SessionSettings.SelectedProductId))
         {
             source = "(" + SessionSettings.SelectedProductId+ ")";
         }
     }

     if (Session["updateProducts"] != null && (bool)Session["updateProducts"])
     {
         d = DateTime.Now;
         UpdateProducts();
         Log.Info("Update products status : " + DateTime.Now.Subtract(d).Milliseconds + " ms");
     }

     var ctrl = WebApplicationHelper.GetPostBackControl(this);

     //Prevents update by timer when refreshing something else
     if (!(ctrl is Timer))
     {
         tmrTimer.Enabled = false;
     }

     if(ctrl != null)
     {
         CreateMenusDictionnary();
         if (ctrl is Button)
         {
             var p = FindProduct(SessionSettings.SelectedProductId);

             if (Session[SessionSettings.TABLE_MANAGER_KEY] == null)
             {
                 Session[SessionSettings.TABLE_MANAGER_KEY] = new ProductsInfoTableManager(productInfoTable);
             }
             var manager = (ProductsInfoTableManager)Session[SessionSettings.TABLE_MANAGER_KEY];
             manager.SetProductsInfoTable(productInfoTable);
             source = "(Expand button)";
             switch (ctrl.ID)
             {
                 case "diffButton":
                     SessionSettings.ShowDifferences = !SessionSettings.ShowDifferences;
                     manager.RefreshDiffFixes(p);
                     break;
                 case "fixesButton":
                     SessionSettings.ShowFixes = !SessionSettings.ShowFixes;
                     manager.RefreshDiffFixes(p);
                     break;
                 case "manualTestsDisplayChangelistsButton":
                     source = "(manualTestsDisplayChange)";
                     SessionSettings.ShowManualTestsByType = ExcelTestsReader.AggregateType.Changelist;
                     SessionSettings.TurnOffTestsDisplay();
                     manager.RefreshManualTests(p);
                     break;
                 case "manualTestsDisplayTestNamesButton":
                     source = "(manualTestsDisplayChange)";
                     SessionSettings.ShowManualTestsByType = ExcelTestsReader.AggregateType.Test;
                     SessionSettings.TurnOffTestsDisplay();
                     manager.RefreshManualTests(p);
                     break;
                 default:
                     if (ctrl.ID.StartsWith("errors_"))
                     {
                         SessionSettings.ToggleShowErrors(ctrl.ID);
                         manager.RefreshWorkflowErrors(p);
                     }
                     else if (ctrl.ID.StartsWith("manualTestsExpand_"))
                     {
                         SessionSettings.ToggleShowManualTest(ctrl.ID);
                         manager.RefreshManualTests(p);
                     }
                     else
                     {
                         DisplaySelectedProductInfo();
                     }
                     break;
             }
         }

         if (ctrl is Timer)
         {
             source = "(timer)";
             d = DateTime.Now;
             UpdateProducts();
             Log.Info("Update products status (timer) :" + DateTime.Now.Subtract(d).Milliseconds + " ms");
             DisplaySelectedProductInfo();
         }
     }
     Log.Info("Total init time " + source + " : " + DateTime.Now.Subtract(t).Milliseconds + " ms");

     //Reactivates timer
     if (!tmrTimer.Enabled)
     {
         tmrTimer.Enabled = true;
     }
 }


 //Refreshes the informations periodically for real-time monitoring
 protected void tmrTimer_Tick(object sender, EventArgs e)
 {

 }

AnswerRe: asp.net site taking all the CPU after a while Pin
jkirkerx10-Mar-14 14:01
professionaljkirkerx10-Mar-14 14:01 
GeneralRe: asp.net site taking all the CPU after a while Pin
Amaranth1311-Mar-14 4:33
Amaranth1311-Mar-14 4:33 
GeneralRe: asp.net site taking all the CPU after a while Pin
jkirkerx11-Mar-14 7:10
professionaljkirkerx11-Mar-14 7:10 
QuestionSet label for gridview while export to excel Pin
vignesht507-Mar-14 7:52
vignesht507-Mar-14 7:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.