加快 Web 应用程序编译速度

发布于 2024-10-12 13:59:36 字数 594 浏览 7 评论 0原文

我尝试过查看“相关”问题来寻找答案,但它们似乎实际上并不相关...

基本上我有一个带有目录、管理部分的 VB.Net 应用程序(可以更改目录、监视页面视图)等等)以及客户前端的其他基本页面。

当我在本地计算机上编译并运行该应用程序时,它似乎编译得相当快并且运行得非常快。然而,当部署在服务器上时,第一个页面加载似乎需要永远和一天的时间(无论它是什么页面,有多少样式表/JS文件,有多少图像,页面标记有多大,以及很快)。在此之后,所有页面加载速度都非常快。我的猜测是这是因为必须从头开始加载代码;之后,直到它被回收为止,应用程序运行得非常快。有谁知道我如何才能加快应用程序的这一部分?我担心某些客户(例如我自己的慢速连接,低于拨号速度)可能会因为加载速度不够快而离开该网站,而永远不会返回。任何帮助将不胜感激。

提前致谢。

问候,

理查德

PS如果您参考我的其他一些问题,您会发现更多有关系统的信息,例如大多数数据在第一页加载时加载到对象中 - 我正在慢慢地解决这个问题,但是它似乎并没有产生太大的影响。我曾考虑过使用 Linq-to-SQL 来代替,但据我所知,这并没有给我太多的灵活性。我宁愿定义自己的系统架构并使其特定于公司,而不是在 Linq-to-SQL 的限制内工作。

I have tried looking at "related" questions for answers to this but they don't seem to actually be related...

Basically I have a VB.Net application with a catalogue, administration section (which can alter the catalogue, monitor page views etc etc) and other basic pages on the customer front end.

When I compile and run the app on my local machine it seems to compile fairly quickly and run very fast. However when deployed on the server it seems to take forever and a day on the very first page load (no matter what page it is, how many stylesheets / JS files there are, how many images there are, how big the page markup is and so on). After this ALL the pages load really fast. My guess is this is due to having to load the code from scratch; after that, until it is recycled, the application runs perfectly fast. Does anyone have any idea how I could speed this part of the application up? I am afraid that some customers (on slow connections such as my own at less than dial-up speed) may be leaving the site never to return as a result of it not loading fast enough. Any help would be greatly appreciated.

Thanks in advance.

Regards,

Richard

PS If you refer to some of my other questions you will find out a bit more about the system, such as the fact that most of the data is loaded into objects on the first page load - I am slowly sorting this out but it does not appear to be making all that much of a difference. I have considered using Linq-to-SQL instead but that, as far as I know, does not give me too much flexibility. I would rather define my own system architecture and make it specific to the company, rather than working within the restrictions of Linq-to-SQL.

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

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

发布评论

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

评论(1

鸠书 2024-10-19 13:59:36

如果可以的话,最快捷、最简单的解决方案就是将 AppDomain 配置为在一段时间不活动后不回收。 IIS 6 和 IIS 6 之间的实现方式有所不同。 IIS 7。

另一种选择是编写一个小型实用程序,每 4 分钟从您的站点请求一个页面,并将其设置为另一台始终打开的 PC 上的计划任务。这至少可以防止超时和随后的 AppDomain 回收的发生。诚然,这是一种黑客手段,但有时任何解决方案都比没有好。

然而,正确的解决方案是预编译您的视图。具体如何完成和部署取决于您的网站的 Visual Studio 项目的确切类型。

If you can, the quickest easiest solution is simply to configure the AppDomain not to recycle after a period of inactivity. How this is accomplished differs between IIS 6 & IIS 7.

Another option is to write a small utility program that requests a page from your site every 4 minutes and set it up as a scheduled task on another PC that is on all the time. That at least will prevent the timeout and consequent AppDomain recycle from happening. It is a hack, to be sure, but sometimes any solution is better than none.

The proper solution, however, is to precompile your views. How exactly to accomplish and deploy that will depend on the exact type of Visual Studio project your web site is.

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