ASP.NET MVC - 慢初始加载 [英] ASP.NET MVC - Slow initial load

查看:249
本文介绍了ASP.NET MVC - 慢初始加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近创建了一个asp.net MVC Web应用程序,并在网上公布。

I've recently created an asp.net mvc web application and published it online.

在第一次加载网页你会发现,它需要约10-15秒,它实际上表明,它的点击一次后然而,它装载尽可能快地期待第二次轮。我只是想知道如果任何人可能有,为什么网站是这么长时间的想法?

When first loading the website you should find that it takes around 10-15 seconds for it to actually show, however after it's clicked once, it loads as quickly as I expect the second time round. I'm just wondering if anyone may have an idea of why the website is taking so long?

推荐答案

通常一个应用程序作为应用程序域启动时总是会需要一些额外的时间来加载。

Typically an application will always take a little extra time to load as the application domain starts up.

东西帮助加剧,这可能是从写得不好code什么(IE:的Application_Start),以某些库您可能正在使用(例如奥姆斯)。多少模块已加载办?

Things helping exacerbate this could be anything from poorly written code (IE: Application_Start) to certain libraries you may be using (ORMs for example). How many modules do you have loaded?

首先检查你的web.config臭名昭著的< compliation调试=真正的。这可以在生产系统中显著的性能后果。将其设置为假!

For starters check your web.config for the infamous <compliation debug="true". That can have significant performance ramifications in a production setup. Set it to "false"!

建议沿着提高应用程序启动时间的台词谷歌搜索的东西,找东西,可能涉及到您的特定应用。

Recommend googling something along the lines of "improving application startup time" and looking for things that may relate to your particular application.

从你的第一个评论更新:

Update from your first comment:

如果您发现该应用程序30分钟一贯这可能与您的应用程序在IIS池回收设置。之后再次启动(几秒钟挂起)

If you're seeing the application start up again (hangs for a few seconds) after 30 minutes consistently this is likely related to your Application Pool Recycling settings in IIS.

进入IIS管理器(这里假设V7 +):

Go into IIS Manager (this assumes v7+):


  1. 应用程序池

  2. 右键单击正在使用您的应用程序(S)池

  3. 选择循环的竞争,一个窗口将拿出标有回收
    条件

  4. 检查这些设置,因为它们将决定何时
    自动的杀死你的应用程序池,并将它重新启动。

  1. Application Pools
  2. Right click the pool being used for your application(s)
  3. Select "Recyling", a window will come up labeled "Recycling Conditions"
  4. Inspect those settings since they will determine when to automatically kill your app pool and have it restart.

在总体性能方面,你可能也想尝试:

In terms of general performance you may want to try:


  1. 添加,在吐出经过时间的一些调试语句您
    的Application_Start()方法或任何其他适用的位置尝试
    抓什么时间最长。

  2. 创建一个完全干净的示范项目,并部署它。看它是否
    从同样的问题困扰。如果不尝试引入更多
    更多你的真实code,直到你发现放缓。

如果你的真正难倒#2可能是即使将可能是最慢的选择你最好的选择。

If you're really stumped #2 may be your best bet even though it will be probably be the slowest option.

这篇关于ASP.NET MVC - 慢初始加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆