0

我的网站在其索引页面中有很多菜单和子菜单,这些子菜单是从 db 加载的。Ajax 用于加载子菜单。因此,加载整个页面需要花费大量时间。我将如何减少加载时间。我正在使用 asp.net mvc3 和 sql server 2008 数据库

4

2 回答 2

1

在没有实际看到的情况下很难说出解决方案中的瓶颈是什么,但听起来你可以通过缓存受益匪浅,在 ASP.NET MVC 中这很容易做到,这里是关于这个主题的另一个很棒的教程。哦,记住 -> “计算机科学中有 2 个难题:缓存、命名和非 1 错误”;)

于 2013-04-15T06:37:15.107 回答
0

There are many things that could be going wrong and causing your application to run slowly.

I’d recommend you turn the trace feature on because that will tell you what may be wrong. As Dimitar Dimitrov already mentioned you can try to cache the query in some way so you don’t have to retrieve it every time.

Another option would be to optimize the query so that it fetches all menus and submenus in one query.

But again, don’t do anything specifically until you’ve profiled your application to see where specifically is the issue.

于 2013-04-15T09:00:24.710 回答