网站需要的时间非常长的时间来启动第一次访问,(最多68秒计) [英] Web site takes unusually long time to start the first time it is accessed, (Up to 68 seconds in total)

查看:182
本文介绍了网站需要的时间非常长的时间来启动第一次访问,(最多68秒计)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个ASP.Net应用程序,需要一个非常长的时间来启动第一次访问。我做了一些跟踪,我发现有57秒在这个函数花费:

I have an ASP.Net application that takes an unusually long time to start up the first time it is accessed. I did some tracing and I found that 57 seconds are spent in this function:

布尔System.Web.Compilation.WebDirectoryBatchCompiler.CompileNonDependentBuildProviders(ICollection)

和反过来的函数调用以下任一操作6次:

and that function in turn calls the following one 6 times:

虚空System.Web.Compilation.WebDirectoryBatchCompiler.CompileAssemblyBuilder(AssemblyBuilder)

我的问题是什么呢 System.Web.Compilation.WebDirectoryBatchCompiler.CompileAssemblyBuilder 吗?我的Web应用程序已经编译,我不知道为什么它做任何类型的在启动编制工作。这正常吗?是不是有什么事情,我不知道?

My question is what does System.Web.Compilation.WebDirectoryBatchCompiler.CompileAssemblyBuilder do? My web application is already compiled, I don't know why it is doing any kind of compilation work on start-up. Is this normal? Is there something going on that I don't know about?

推荐答案

有相当当一个ASP.NET应用程序启动时发生了一点引导的。这包括工作进程踢,组件加载到的AppDomain ,并在当前目录还编译文件。此批编译过程每个文件夹,这意味着如果我要求 / 首次,批处理编译器将扫描的文件夹,支持的类型,编译它们,并缓存结果。这是只有root / 文件夹内完成。我的第一个请求到另一个 / OffRoot 文件夹会导致另一批编译。

There is quite a bit of bootstrapping that occurs when an ASP.NET application is started. This includes the worker process kicking in, assemblies loaded into the AppDomain, and also compilation of files in the current directory. This batch compilation process is per folder, which means if I request / for the first time, the batch compiler will scan the folder for supported types, compile them, and cache the result. This is only done within the root / folder. My first request to another /OffRoot folder will result in another batch compile.

如果你有一个precompiled网站,运​​行时仍然执行这种类型的扫描,但确定它没有编译任何东西。

If you have a precompiled site, the runtime still performs this type of scan but determines that it doesn't have to compile anything.

有一个pre-编译网站,编译Web应用程序之间的一个重要区别。一个pre-编译的网站都会有这样的一审编译完成的时间提前,所以只需要在组件加载到的AppDomain 需要的地方。随着编译Web应用程序,你编译基源$ C ​​$ C,但意见(的.aspx )的文件不会被编译,所以它仍保持着这种首次编译(动态编译)。

There is an important difference between a pre-compiled Website, and a compiled Web Application. A pre-compiled Website will have this first-instance compilation done ahead of time, so it need only load the assemblies into the AppDomain where it needs to. With a compiled Web Application, you have compiled base source code, but the views (.aspx) files are not compiled, so it still does that first-time compilation (dynamic compilation).

这篇关于网站需要的时间非常长的时间来启动第一次访问,(最多68秒计)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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