简体   繁体   English

提高ASP.NET应用程序的性能

[英]Improve the performance of an ASP.NET application

How to improve the performance of an ASP.NET application? 如何提高ASP.NET应用程序的性能? Which are are the fields I should take care? 我应该注意哪些领域? The application includes DB connections and Image Parsing etc. 该应用程序包括数据库连接和图像分析等。

I wrote a book about this that was just released, called Ultra-Fast ASP.NET: Build Ultra-Fast and Ultra-Scalable web sites using ASP.NET and SQL Server . 我写了一本关于这个的书,刚刚发布,名为Ultra-Fast ASP.NET:使用ASP.NET和SQL Server构建超快速和超可扩展的网站

The book is about 500 pages long, so there's a fair amount you can do, at all tiers: client (HTML/JavaScript structure), IIS, ASP.NET, SQL Server, infrastructure, etc. 这本书大约有500页,所以你可以在各个层面做很多事情:客户端(HTML / JavaScript结构),IIS,ASP.NET,SQL Server,基础设施等。

try avoiding unnecessary postbacks to pages, there are a lot of features you can implement by using things like jQuery or ExtJs framework. 尝试避免对页面进行不必要的回发,有很多功能可以通过使用jQuery或ExtJs框架来实现。 Learn how to do AJAX calls and pass info between your app and the server via JSON result sets. 了解如何通过JSON结果集进行AJAX调用并在应用程序和服务器之间传递信息。

Also, install apps like FireBug and YSlow and use these to analyze your application and follow their recommendations on how to speed up your app. 此外,安装FireBug和YSlow等应用程序并使用它们来分析您的应用程序,并按照他们关于如何加速您的应用程序的建议。 Good luck! 祝好运!

  1. HTTP Compression HTTP压缩
  2. Disable Possible ViewState 禁用可能的ViewState
  3. Changes in the Web.Config File : Use page caching, Remove unnecessary httpModules, Turn off trace, Disabled automatic save for profiles, Set debug=false. Web.Config文件中的更改:使用页面缓存,删除不必要的httpModule,关闭跟踪,禁用自动保存配置文件,设置debug = false。
  4. Implement Cache Dependency 实现缓存依赖性
  5. Optimize Stylesheets 优化样式表
  6. Optimize JavaScript 优化JavaScript
  7. JS and CSS File Position JS和CSS文件位置
  8. server.transfer() Instead of response.redirect() server.transfer()而不是response.redirect()
  9. Client-side Script for Validation 用于验证的客户端脚本

The book Improving .NET Application Performance and Scalability has a chapter on Improving ASP.NET Performance , that might be worth reading. 改进.NET应用程序性能和可伸缩性 ”一书中有一章关于改进ASP.NET性能 ,可能值得一读。 The full book is online at MSDN, and is also available as a PDF download . 完整的书籍在MSDN上在线,也可以PDF格式下载

Here's an excerpt from the book Jeff, Phil, and K. Scott Allen wrote: 8 ASP.NET Performance Tips . 这是摘自Jeff,Phil和K. Scott Allen写的: 8 ASP.NET性能提示 It's a few years old, but most of it's pretty timeless. 它已经有几年了,但大部分都是永恒的。

My checklist: 我的清单:

  1. Find out what's slow by testing 通过测试找出什么是缓慢的
  2. Cache what you can (application cache, output cache, etc.) 缓存你可以做的事情(应用程序缓存,输出缓存等)
  3. Reduce page size (eliminate viewstate, compress images, use CSS instead of inline styles, etc.) 减少页面大小(消除视图状态,压缩图像,使用CSS而不是内联样式等)
  4. Find out which external dependencies are slowing you down (worst queries, webservices, etc.). 找出哪些外部依赖关系正在减慢您的速度(最糟糕的查询,Web服务等)。
  5. Offload processing to the client (jQuery for filtering vs. round trips to the server to server to re-query) 卸载到客户端的处理(jQuery用于过滤与往返服务器到服务器的重复查询)

Use the .NET CLR profiler to determine where optimization will be useful. 使用.NET CLR分析器确定优化将在何处有用。

http://msdn.microsoft.com/en-us/magazine/cc301839.aspx http://msdn.microsoft.com/en-us/magazine/cc301839.aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM