Weird issue in Site Performance

xrxarmstrong

New Member
We have very weird problem with our web site. When we run our site for the first time in the day (it is not first time after deployment) it runs very slow and take 5 minutes to load the page (any browser) even if no body is connected to that site at that moment. But, once we start using it, opens various pages, it runs like a charm - very fast (not more than 4 seconds) I mean to say and even if single or multiple users are connected to it. In clear terms, if site remains idle, site performs badly for the first time but once we start using it, it runs in usual. We are using following to build the site: [*]MVC 4 [*]Dot net framework 4.5 [*]Database: SQLAnywhere and SQL Server 2008 (we have tried to use both the database to resolve the issue but no success) [*]Entity Framework 5.0 using Web API model and we are using jQuery call to have data on page and showing them on DataTable grid (http://www.datatables.net/) [*]Hosted on IIS 7.5 Note: This site was working correctly few days back but we don't know what went wrong (in code or hosting settings etc.) during last few deployments but it works very slow. We have tried with everything but now we are in need of your expert guidance. Many thanks in advance.My code in global.asax.cs is:====================================\[code\] protected void Application_Start() { AreaRegistration.RegisterAllAreas(); WebApiConfig.Register(GlobalConfiguration.Configuration); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); //ConfigureApi(GlobalConfiguration.Configuration); GlobalConfiguration.Configuration.Filters.Add(new ModelValidationFilterAttribute()); FilterConfig.RegisterHttpFilters(GlobalConfiguration.Configuration.Filters); BundleTable.EnableOptimizations = true; } protected void Session_Start(object src, EventArgs e) { SessionHelper.EnterPriceID = 1; SessionHelper.CompanyID = 1; SessionHelper.RoomID = 1; SessionHelper.UserID = 1; SessionHelper.RoomName = "Room1"; SessionHelper.UserName = "Admin"; SessionHelper.CompanyResourceFolder = SessionHelper.EnterPriceID.ToString() + "_" + SessionHelper.CompanyID.ToString(); eTurns.DTO.Resources.ResourceHelper.ResourceDirectoryPath = HttpContext.Current.Server.MapPath(@"\Resources\" + SessionHelper.CompanyResourceFolder) + @"\"; eTurns.DTO.Resources.ResourceHelper.ResourceBaseClassPath = eTurns.DTO.Resources.ResourceHelper.ResourceDirectoryPath.Replace(@"\", "."); System.Globalization.CultureInfo c = new System.Globalization.CultureInfo("en-US"); Thread.CurrentThread.CurrentUICulture = c; Thread.CurrentThread.CurrentCulture = c; Session["CurrentCult"] = c; } public void Application_AcquireRequestState(object sender, EventArgs e) { if (HttpContext.Current.Session != null && Session["CurrentCult"] != null) { string currentCulture = Convert.ToString(Session["CurrentCult"]); if (String.Compare(currentCulture, System.Threading.Thread.CurrentThread.CurrentCulture.ToString(), StringComparison.OrdinalIgnoreCase) != 0) { Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture; try { System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.CreateSpecificCulture(currentCulture); } catch { System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-us"); } } } }\[/code\]====================================
 
Back
Top