缓慢加载第一页 - ASP.NET MVC [英] Slow loading first page - ASP.NET MVC

查看:140
本文介绍了缓慢加载第一页 - ASP.NET MVC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用miniprofiler作为我的页面,因为我认为我的第一页和其他页面的加载时间很大。我从小型飞机开始,但我认为这是非常好的工具。我有这个结果:

I used miniprofiler for my page because I think I have big loading time for my first page and some other pages. I am starting with miniprofiler but I think it is very good tool. I have this result:


  • http:// localhost:50783 / 192.2 + 0.0


    • 从数据库2.2 +186.9获取文章

    • 查找:索引866.4 +190.9

    • 渲染:索引1839.0 +1058.1


      • 查找:_Article 530.0 +2809.0

      • 渲染部分:_Article 64.3 +3339.2渲染部分:_Article 8.2 +3404.2

      • 渲染部分:_Article 12.5 +3413.0

      • 渲染部分: _文字8.7 +3426.2

      • 渲染部分:_Art 7.9 +3435.4

      • 渲染部分:_LeftMenu 64.8 +3520.4


      • 渲染部分:_RightMenuTest 2530.1 +3591.2

      • 渲染部分:_NextMatch 3.5 +4088.7

      • 渲染部分:_Standings 4.7 +4226.5

      • 渲染部分:_Footer 21.2 +6137.4


        • http://localhost:50783/ 192.2 +0.0
          • Getting articles from database 2.2 +186.9
          • Find: Index 866.4 +190.9
          • Render : Index 1839.0 +1058.1
            • Find: _Article 530.0 +2809.0
            • Render partial: _Article 64.3 +3339.2
            • Render partial: _Article 8.2 +3404.2
            • Render partial: _Article 12.5 +3413.0
            • Render partial: _Article 8.7 +3426.2
            • Render partial: _Article 7.9 +3435.4
            • Render partial: _LeftMenu 64.8 +3520.4
            • Render partial: _LogOnPartial 3.3 +3556.3
            • Render partial: _RightMenuTest 2530.1 +3591.2
            • Render partial: _NextMatch 3.5 +4088.7
            • Render partial: _Standings 4.7 +4226.5
            • Render partial: _Footer 21.2 +6137.4

            有人可以帮助我减少那个时间在哪里Find?这是什么意思?我知道RightMenuTest有最大的时间,我也试图减少它。我有很多我自己的帮手,我认为这是部分视图_RightMenuTest的问题。所以我需要帮助减少别人的时间。

            Can anybody help me with reducing that times where is Find? What it means? I know that RightMenuTest has the biggest time and I am trying to reduce it too. I have many my own helpers there and I think that is problem with partial view _RightMenuTest. So I need help with reducing that others times.

            谢谢

            已编辑:

            _Article:

            @model SkMoravanSvitavka.Models.Article
            <h3>@Html.ActionLink(Model.Title, "Zobrazit", "Clanek", new { id = Model.ArticleID }, null)</h3>
            
                <p>@Html.Raw(Html.ArticleImageToSmall(Html.Article(Model.Text))) </p>
            
            @Html.ActionLink("Počet komentářů:" + Model.Comments.Count, "Zobrazit", "Clanek", new { id = Model.ArticleID }, null)
            

            文章索引视图:

            @model IEnumerable<SkMoravanSvitavka.Models.Article>
            @{
                ViewBag.Title = "Sk Moravan Svitávka - oficiální stránky fotbalového klubu";
            }
            @if (Model != null)
            {
                foreach (var item in Model)
                {
                    @Html.Partial("_Article", item);
                }
            }
            

            文章控制器中的索引:

            public ActionResult Index()
                    {
                        var profiler = MiniProfiler.Current;
                        using (profiler.Step("Getting articles from database"))
                        {
                            var model = repo.GetLatestArticles(5);
                            return View(model);
                        }
                    }
            


            推荐答案

            确保在项目在发布模式下编译时进行测试。已知ASP MVC进行额外的反射,以便在调试模式下查看更多全面的调试功能。

            Make sure to do the tests when the project is compiled in Release mode as well. ASP MVC is known to perform extra reflection to find views in Debug mode for more comprehensive debugging capabilities.

            这篇关于缓慢加载第一页 - ASP.NET MVC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆