我们的网站存在非常奇怪的问题。当我们在当天第一次运行我们的站点时(它不是在部署后第一次)它运行速度非常慢并且需要5分钟才能加载页面(任何浏览器),即使此时没有正文连接到该站点。但是,一旦我们开始使用它,打开各种页面,它就像一个魅力 - 非常快(不超过4秒)我的意思是说,即使单个或多个用户连接到它。从清晰的角度来看,如果网站仍处于闲置状态,网站首次表现不佳,但一旦我们开始使用网站,它就会正常运行。我们正在使用以下内容来构建网站:
注意:这个网站几天前工作正常但我们不知道在最近几次部署中出现了什么问题(在代码或托管设置等方面),但它的工作速度非常慢。我们尝试了一切,但现在我们需要您的专业指导。
非常感谢提前。
我在global.asax.cs中的代码是:
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");
}
}
}
}
答案 0 :(得分:0)
将IDEAL TIMEOUT 20 M增加到900 M(根据您的方便)....
我希望这有效......