.NET basic optimization principle

xiaoxiao2021-03-06  73

Reduce unnecessary resource consumption: CPU, memory performance improvement skills 1, avoid unnecessary implementation Page_Load and ISPostback

2, close unnecessary session status <% @ page enablessionState = "false"%> 3, you can close the ViewState <% @ Page EnableViewState = "false"%> 4, do not use Exception control program process try {result = 100 / num;} catch (exception e) {result = 0;

IF (Num! = 0) Result = 100 / Num; ElseResult = 0; 5, disable VB and JScript dynamic data type <% @ page language = "vb" strict = "true"%> 6, using stored procedure data access 7 Read-only Data Access Don't use DataSet to use SqlDataReader instead of DataSetSqlDataReader is Read-Only, Forward-Only8, close ASP.NET Debug mode 9, use ASP.NET OUTPUT CACHE Buffer Data ASP.NET Output Buffer Page Cuff Cuff Curruption <% @ OutputCache% > DURATIONVARYBYPARAM Piece Cushion Cushion VarybyControlASP.NET Output Buffer Data Scoot Expressions

Cache.insert ("MyData", Source, New Cachedependency (Server.MAppath))))));

Cache.Insert ("MyData", Source, Null, DateTime.now.addhours (1), Timespan.zero;

Cache.Insert ("MyData", Source, Null, DateTime.maxValue, Timespan.fromminutes (20));

转载请注明原文地址:https://www.9cbs.com/read-92518.html

New Post(0)