在本地PC IIS和浏览器马克塞斯CPU大的结果集 [英] On local PC IIS and Browser maxes out CPU with large result set

查看:175
本文介绍了在本地PC IIS和浏览器马克塞斯CPU大的结果集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚升级到VS 2013,也开始了新的MVC项目,并通过IIS我正在面临着99%的CPU使用率几分钟,而我在本地计算机上调试。 (在这两个发布和调试模式下发生的)我才意识到这个问题是正比于通过LINQ查询返回的行数。如果我使用取(1)或带(10),它的罚款。如果我使用时采取(100)的问题。

I just upgraded to VS 2013 and also started a new MVC project, and am being faced with 99% CPU usage for a couple minutes by IIS while debugging on my local PC. (Happens in both Release and Debug mode) I just realized that the problem is proportional to the number of lines returned by by Linq Query. If I use Take(1) or Take(10) it's fine. If I use Take(100) the problem occurs.

下面是我的ActionResult(私人信息改变):

Here is my actionresult (with private info altered):

    public ActionResult Summary(string daystoshow, DateTime? day = null)
    {
        int daysToShow = daystoshow.ToSafeInt();
        if (daysToShow < 1) daysToShow = 2;
        if (day == null) day = Convert.ToDateTime("4/14/2014");  
        SummaryViewModel m = new SummaryViewModel();
        string warnings = "";
        var ef1 = new carshowEntities();

        DateTime dayAtMidnight = Convert.ToDateTime(((DateTime)day).AddDays(daysToShow).ToShortDateString());

        var diplayItems = (from x in ef1.islands
                             join y in ef1.cars on x.serid equals y.serid where x.dt==12  
                             join z in ef1.ITEMS on y.serviceno equals z.ITEMNO
                             join x2 in ef1.islands on x.serid equals x2.serid where x2.dt==8 
                             join i in ef1.INVOICES on x.carStyle equals i.carStyle where i.STATUS==8
                             where x.LiscenceDate > day && x.LiscenceDate < dayAtMidnight
                             orderby x.LiscenceDate, y.serviceno, x.serid
                             select new ReturnedItem()
                             {
                                 CarOrderDate = (DateTime)x.LiscenceDate,
                                 serial = x.serid,
                                 ItemCode = y.serviceno,
                                 Description = z.Color,
                                 DateSold = (DateTime)x2.LiscenceDate,
                                 ID = i.IX_ID
                             }).Take(100).ToList();



        m.daystoshow = daysToShow;
        m.day = day;
        m.diplayItems = diplayItems;
        m.warnings = warnings;
        return View(m);
    }

我还没有发现,这里描述的确切情况的任何其他职位。

I haven't found any other posts that describe the exact circumstances here.

1)当网站发布后,它完美罚款从服务器。

1) When the site is published, it works perfectly fine from the server.

2)的CPU使用率在调试模式下运行我的MVC项目时上升到99%以上。

2) CPU usage goes up to 99% when running my MVC project in debug mode.

3),如果我在本地发布的问题不会发生。

3) The problem does not happen if I publish locally.

4)VS在调试运行或释放模式时,这发生在IIS和IIS防爆preSS。

4) This happens in both IIS and IIS Express when run from VS in Debug or Release mode.

5)它不与其他网站发生,仅这一个项目至今。

5) It doesn't happen with other sites, just this one project so far.

6)这是一个简单的项目,人们的ActionResult,并与约200行的表一页,填充了LINQ查询。

6) It's a simple project, one actionresult, and one page with a table of about 200 lines, populated with a Linq query.

有没有办法调试器到至少告诉我它在做什么?

Is there any way for the debugger to at least show me what it's doing?

编辑:

通过进一步调查,我发现,如果我等待2分钟内CPU来自IIS回来,但随后的Web浏览器(Firefox或Chrome)占据了99%的CPU为2分钟。

With further investigation, I notice that if I wait 2 minutes the CPU comes back from IIS, but THEN the Web Browser (Firefox or Chrome) takes up 99% CPU for another 2 minutes.

推荐答案

我发现,解决办法是干脆关掉<一个href=\"http://blogs.msdn.com/b/webdev/archive/2013/06/28/browser-link-feature-in-visual-studio-$p$pview-2013.aspx\">Browser链接,这是一个新的功能在VS 2013年,许多调试和搜索之后。

I found that the solution was simply to turn off "Browser Link" which was a new feature in VS 2013, after much debugging and searching.

浏览器链接可​​以在工具栏上单击,看起来像一个刷新按钮图标上的向下箭头被关闭。

Browser Link can be turned off in the toolbar by clicking the down arrow on the icon that looks like a refresh button.

浏览器链接进行更改浏览器本身,这似乎是CPU密集型的页面,这样做是有大量元素使CPU秒杀的某种方式。

Browser link is some way of making changes to the page in the browser itself, which seems to be CPU intensive, so doing that with a large number of elements causes the CPU to spike.

这篇关于在本地PC IIS和浏览器马克塞斯CPU大的结果集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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