ASP.NET 3.5 Web应用程序项目初始加载需要很长时间

时间:2022-10-19 21:26:54

I have started work at a new company and the main project I work on (an ASP.NET 3.5 Web Application Project) takes an excessively long time to initially load (Around 1.5 minutes)

我已经开始在一家新公司工作,我工作的主要项目(ASP.NET 3.5 Web应用程序项目)需要花费很长时间才能进行初始加载(大约1.5分钟)

I am aware that this is generally the nature of web app projects but my issue is this seems way too long.

我知道这通常是Web应用程序项目的本质,但我的问题似乎太长了。

Ive tried several things to try and pinpoint what might be causing this lag including Replacing the web.config with a fresh one created from a new project cleared everything from my app_start in my web.config deleted all weppart dlls from my bin folder (which leaves me with 19 dlls in my bin directory including 6 from the MS enterprise library)

我已经尝试了几个尝试并找出可能导致这种延迟的原因,包括用新项目创建的新文件替换web.config清除了我的web.config中的app_start所有内容从我的bin文件夹中删除了所有weppart dll(其中我在bin目录中有19个dll,包括来自MS企业库的6个dll)

and still it takes a very long time to load.

仍然需要很长时间才能加载。

I was wondering if anyone had any pointers as to how I may go about finding out what causes such a huge load time or of any tools that would help me see what my app is doing when it starts

我想知道是否有人有任何关于我如何找出导致如此巨大的加载时间或任何工具的任何指示,以帮助我看到我的应用程序在启动时正在做什么

thanks -Kris

谢谢 - 克里斯

5 个解决方案

#1


3  

There is another gotcha in .NET 2.0 onwards. If you have any signed assemblies in you bin folder, then CLR tries connect to a VeriSign URL and fetches a revocation list of the certificates to see if they are valid.

从.NET 2.0开始还有另一个问题。如果您的bin文件夹中有任何已签名的程序集,则CLR会尝试连接到VeriSign URL并获取证书的吊销列表以查看它们是否有效。

This could eat up some of your startup time as well. If you think this could be contributing to your problem then you can have a look at the following to MS articles:

这可能会占用你的一些启动时间。如果您认为这可能会导致您的问题,那么您可以查看MS文章的以下内容:

http://digital.ni.com/public.nsf/allkb/18E25101F0839C6286256F960061B282
http://support.microsoft.com/kb/936707

To deal with this on a per-application basis you can add the following settings under the config section in your app.config/web.config.

要在每个应用程序的基础上处理此问题,您可以在app.config / web.config的config部分下添加以下设置。

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <runtime>
       <generatePublisherEvidence enabled="false" />
    </runtime>
</configuration>

Of course, if you add this setting, the signed DLLs will not be verified for their validity anymore!

当然,如果添加此设置,签名的DLL将不再验证其有效性!

#2


2  

Try a warm-up script.

试试热身剧本。

JetBrains DotTrace is an excellent ASP.NET profiler.

JetBrains DotTrace是一款优秀的ASP.NET分析器。

#3


0  

How many projects are there? If you have heaps of assemblies and dlls in the bin directory, that can slow load times considerably (even if they are quite small). That's the best I can suggest.

有多少个项目?如果bin目录中有大量的程序集和dll,那么可以大大减慢加载时间(即使它们非常小)。这是我能建议的最好的。

#4


0  

Try using the SQL Profiler and watch the associated database activity during startup.

尝试使用SQL事件探查器并在启动期间查看关联的数据库活动。

Chances are, there's a load of queries hitting the database on the first page view to initialize the various caches.

可能是,在第一页视图上有大量查询命中数据库以初始化各种缓存。

If that is the case, you could focus your effort on optimizing the queries that are causing the most blocking.

如果是这种情况,您可以集中精力优化导致阻塞最多的查询。

#5


0  

ANTS profiler by RedGate could give you some hints as to what is possibly slowing you down.

RedGate的ANTS分析器可以给你一些关于可能减慢你速度的提示。

Set a breakpoint on Page_Load in Default.aspx.cs and start going.

在Default.aspx.cs中的Page_Load上设置断点并开始运行。

Check the Global.asax file to see if anything is being loaded that you're unaware of.

检查Global.asax文件以查看是否正在加载您不知道的任何内容。

Do other projects load quickly? Do you have other programs running which might be slowing down your machine? As you mention, .NET apps take the longest on the initial load... do you have a lot of references (outside libraries, dll's... etc...)

其他项目是否快速加载?你有其他运行的程序可能会降低你的机器速度吗?正如您所提到的,.NET应用程序在初始加载时花费的时间最长...您是否有很多引用(库外,dll等等...)

If you publich to a staging or dev server, does it load quickly?

如果您公开登台或开发服务器,它是否会快速加载?

#1


3  

There is another gotcha in .NET 2.0 onwards. If you have any signed assemblies in you bin folder, then CLR tries connect to a VeriSign URL and fetches a revocation list of the certificates to see if they are valid.

从.NET 2.0开始还有另一个问题。如果您的bin文件夹中有任何已签名的程序集,则CLR会尝试连接到VeriSign URL并获取证书的吊销列表以查看它们是否有效。

This could eat up some of your startup time as well. If you think this could be contributing to your problem then you can have a look at the following to MS articles:

这可能会占用你的一些启动时间。如果您认为这可能会导致您的问题,那么您可以查看MS文章的以下内容:

http://digital.ni.com/public.nsf/allkb/18E25101F0839C6286256F960061B282
http://support.microsoft.com/kb/936707

To deal with this on a per-application basis you can add the following settings under the config section in your app.config/web.config.

要在每个应用程序的基础上处理此问题,您可以在app.config / web.config的config部分下添加以下设置。

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <runtime>
       <generatePublisherEvidence enabled="false" />
    </runtime>
</configuration>

Of course, if you add this setting, the signed DLLs will not be verified for their validity anymore!

当然,如果添加此设置,签名的DLL将不再验证其有效性!

#2


2  

Try a warm-up script.

试试热身剧本。

JetBrains DotTrace is an excellent ASP.NET profiler.

JetBrains DotTrace是一款优秀的ASP.NET分析器。

#3


0  

How many projects are there? If you have heaps of assemblies and dlls in the bin directory, that can slow load times considerably (even if they are quite small). That's the best I can suggest.

有多少个项目?如果bin目录中有大量的程序集和dll,那么可以大大减慢加载时间(即使它们非常小)。这是我能建议的最好的。

#4


0  

Try using the SQL Profiler and watch the associated database activity during startup.

尝试使用SQL事件探查器并在启动期间查看关联的数据库活动。

Chances are, there's a load of queries hitting the database on the first page view to initialize the various caches.

可能是,在第一页视图上有大量查询命中数据库以初始化各种缓存。

If that is the case, you could focus your effort on optimizing the queries that are causing the most blocking.

如果是这种情况,您可以集中精力优化导致阻塞最多的查询。

#5


0  

ANTS profiler by RedGate could give you some hints as to what is possibly slowing you down.

RedGate的ANTS分析器可以给你一些关于可能减慢你速度的提示。

Set a breakpoint on Page_Load in Default.aspx.cs and start going.

在Default.aspx.cs中的Page_Load上设置断点并开始运行。

Check the Global.asax file to see if anything is being loaded that you're unaware of.

检查Global.asax文件以查看是否正在加载您不知道的任何内容。

Do other projects load quickly? Do you have other programs running which might be slowing down your machine? As you mention, .NET apps take the longest on the initial load... do you have a lot of references (outside libraries, dll's... etc...)

其他项目是否快速加载?你有其他运行的程序可能会降低你的机器速度吗?正如您所提到的,.NET应用程序在初始加载时花费的时间最长...您是否有很多引用(库外,dll等等...)

If you publich to a staging or dev server, does it load quickly?

如果您公开登台或开发服务器,它是否会快速加载?