如何提高ASP ?NET MVC应用程序性能?
当前回答
如果您正在运行您的ASP。NET MVC应用程序在Microsoft Azure (IaaS或PaaS)上,然后至少在第一次部署之前执行以下操作。
Scan your code with static code analyzer for any type of code debt, duplication, complexity and for security. Always enable the Application Insight, and monitor the performance, browsers, and analytics frequently to find the real-time issues in the application. Implement Azure Redis Cache for static and less frequent change data like Images, assets, common layouts etc. Always rely on APM (Application Performance Management) tools provided by Azure. See application map frequently to investigate the communication performance between internal parts of the application. Monitor Database/VM performance too. Use Load Balancer (Horizontal Scale) if required and within the budget. If your application has the target audience all over the globe, then use Azure Trafic Manager to automatically handle the incoming request and divert it to the most available application instance. Try to automate the performance monitoring by writing the alerts based on low performance.
其他回答
使用捆绑和缩小还可以帮助您提高性能。它基本上减少了页面加载时间。
除了所有关于在服务器端优化应用程序的重要信息外,我还想说你应该看看YSlow。它是提高客户端站点性能的极好的资源。
这适用于所有网站,而不仅仅是ASP。净MVC。
Gzip实现。 对部分视图使用异步呈现。 最小化数据库命中次数。 使用编译后的查询。 运行分析器找出不必要的匹配。优化所有返回响应时间超过1秒的存储过程。 使用缓存。 使用捆绑最小化优化。 对只读内容使用会话缓存和本地存储等HTML 5实用程序。
当通过LINQ访问数据依赖IQueryable…
为什么使用AsQueryable()而不是List()?
... 并利用一个好的存储库模式:
在存储库模式中加载子记录
这将优化数据访问,以确保只加载需要的数据。
Code Climber和这篇博客文章提供了提高应用程序性能的详细方法。
编译后的查询将提高应用程序的性能,但它与ASP没有任何共同之处。净MVC。它将加速每一个db应用程序,所以它不是真正的MVC。
推荐文章
- c# .NET中的App.config是什么?如何使用它?
- 如何找到Java堆大小和内存使用(Linux)?
- 在哪里放置AutoMapper.CreateMaps?
- String类中的什么方法只返回前N个字符?
- 如何在HTML5中改变视频的播放速度?
- 我如何提高ASP。NET MVC应用程序性能?
- 无法解析类型为“Microsoft.AspNetCore.Http.IHttpContextAccessor”的服务
- 如何在没有任何错误或警告的情况下找到构建失败的原因
- Visual Studio弹出提示:“操作无法完成”
- 否ConcurrentList<T>在。net 4.0?
- 在c#中解析字符串为日期时间
- 如何在剃刀视图上引用.css文件?
- 由Jon Skeet撰写的《Singleton》澄清
- 自定义数字格式字符串始终显示符号
- 列表推导式和函数式函数比for循环更快吗?