【问题标题】:Diagnosing slow ASP.Net website startup [closed]诊断缓慢的 ASP.Net 网站启动 [关闭]
【发布时间】:2019-06-06 02:45:41
【问题描述】:

在 IISReset 或在 Visual Studio 中构建后,我们的 ASP.Net 网络表单站点通常需要五分钟才能启动并呈现第一页。我们已经在 web.config 中使用了诸如 optimizeCompilations 属性之类的东西,并取得了一些进展,但想了解更多关于为什么需要这么长时间以及确切的瓶颈在哪里。

是否有我们可以用来检测和分析 ASP.Net 网站启动期间发生的情况的工具?我们使用的是 IIS7,我们的网站是用 .Net 4.0 编译的。

【问题讨论】:

标签: asp.net performance


【解决方案1】:

花费时间过长的原因是在 web.config 上的 Compilation key 上找到了 the batch compile

您可以更改一些批处理相关参数以将批处理编译限制为更少的页面/模块,从而使您的网站启动得更快一些。 The Schema and the values that affect that:

<compilation 
   debug="[true|false]"
   batch="[true|false]"
   batchTimeout="number of seconds"
   maxBatchSize="maximim number of pages"
   maxBatchGeneratedFileSize="maximum combined size"
   numRecompilesBeforeAppRestart="number"
   optimizeCompilations="[true|false]"

如果您想了解编译时发生了什么,您可以尝试使用来自 MS Windows SysInternals 的Process Monitor。您可以看到当时所有的文件读取和编译,以及正在打开/检查的内容等。

我在本地(不在服务器上)使用的示例

<compilation debug="true" batch="false" 
     optimizeCompilations="true" maxBatchGeneratedFileSize="800" maxBatchSize="100" >

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-03-10
    • 2011-02-06
    • 2010-09-06
    • 1970-01-01
    • 2011-09-22
    • 1970-01-01
    相关资源
    最近更新 更多