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

发布于 2024-07-20 22:30:03 字数 393 浏览 9 评论 0原文

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

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

我尝试了几种方法来尝试找出可能导致这种延迟的原因,包括 将 web.config 替换为从新项目创建的新配置 清除了 web.config 中 app_start 中的所有内容 从我的 bin 文件夹中删除了所有 webpart dll(这使得我的 bin 目录中留下了 19 个 dll,其中包括 MS 企业库中的 6 个),

但加载仍然需要很长时间。

我想知道是否有人对我如何找出导致如此长的加载时间的原因或任何可以帮助我了解我的应用程序在启动时正在做什么的工具有任何指示。

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)

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

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 webpart dlls from my bin folder (which leaves me with 19 dlls in my bin directory including 6 from the MS enterprise library)

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

情域 2024-07-27 22:30:03

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

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

https://digital.ni.com/public.nsf/allkb/18E25101F0839C6286256F960061B282

https://support.microsoft.com/kb/936707

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

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

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

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.

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:

https://digital.ni.com/public.nsf/allkb/18E25101F0839C6286256F960061B282

https://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.

<?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!

司马昭之心 2024-07-27 22:30:03

尝试预热脚本

JetBrains DotTrace 是一款出色的 ASP.NET 分析器。

Try a warm-up script.

JetBrains DotTrace is an excellent ASP.NET profiler.

你与清晨阳光 2024-07-27 22:30:03

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

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.

帥小哥 2024-07-27 22:30:03

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

有可能,在第一个页面视图上有大量查询访问数据库以初始化各种缓存。

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

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

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.

心清如水 2024-07-27 22:30:03

RedGate 的 ANTS 分析器可以为您提供一些提示,了解哪些因素可能会拖慢您的速度。

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

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

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

如果您公开到临时或开发服务器,它会加载吗迅速地?

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

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

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

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...)

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文