English 中文(简体)
我如何能够加快我的MVC asp.net网站?
原标题:How can I speed up my MVC asp.net website?

Hi Everyone I am working on my first MVC 3 website built in C# in asp.net I am having some trouble with with the speed of the website as it takes over 45 seconds to expand or contract the tables that show the database.

我列入了我的《报告模板守则》,我对此感到 j。

我一直在试图说明如何使用海滩,但令我担心的是,当管理人员需要最新数据时,数据不会更新。

@{
ViewBag.Title = "ReportTemplate";
}

<script language="javascript" type="text/javascript">
$(document).ready(function () {

    toggle = function (className) {
        $( .  + className).toggle( fast );
    }


});

</script>

<h2>ReportTemplate</h2>

<p>
@Html.ActionLink("Create New", "Create")    
</p>
<table>
<tr>
    <th>
        INVESTMENT AREA
    </th>
    <th>
        MAJOR PROGRAM
    </th>
    <th>
        MANAGER
    </th>
    <th>
        PROJECT
    </th> 
    <th>
        SPA
    </th>
    <th>
        PA
    </th>                                 
</tr>

@{
string investment_area = "";
string major_program = "";
string manager = "";
string project = "";
string spa = ""; 
string pa = "";
string iaClass = "";
string mpClass = "";
string manClass = "";
string pjClass = "";
string spaClass = "";
string paClass = "";
}
    @foreach (var item in Model)
{
iaClass = item.investment_area.Substring(0, 2);
mpClass = item.major_program;
manClass = item.manager;
pjClass = item.project;
spaClass = item.spa;
paClass = item.pa;

    if (investment_area != item.investment_area)
{

<tr>        
  <td class = "ndeTable ui-widget-header pointer border" onclick="toggle( @iaClass )" colspan="6">
        @item.investment_area
    </td>
</tr>

}
investment_area = item.investment_area;

if (major_program != item.major_program)
{

<tr class="@iaClass">
<td style = "width :200px"></td>
    <td class = "ndeTable pointer border" onclick="toggle( @mpClass )" colspan="5">

    @item.major_program

    </td>
</tr>    
}
major_program = item.major_program;

if (manager != item.manager)
{                
<tr class = "@iaClass @mpClass">
<td></td>
<td style = "width : 100px"></td>
    <td class = "ndeTable pointer border" onclick="toggle( @manClass )" colspan="4">    
    @item.manager
    </td>                
</tr>
}
manager = item.manager;

if (project != item.project)
{
<tr class = "@iaClass @mpClass @manClass">

<td></td>
<td></td>
<td style = "width : 200px"></td>

   <td class = "ndeTable pointer border" onclick = "toggle( @pjClass )" colspan="3">
   @item.project
   </td>
</tr>
}
project = item.project;

if (spa != item.spa)
{
<tr class = "@iaClass @mpClass @manClass @pjClass">

<td></td>
<td></td>
<td></td>
<td style = "width : 325px"></td>

    <td class = "ndeTable pointer border" onclick = "toggle( @spaClass )" colspan = "2">
    @item.spa
    </td>
</tr>
}
spa = item.spa;


<tr class = "@iaClass @mpClass @manClass @pjClass @spaClass">
<td></td>
<td></td>
<td></td>
<td></td>
<td style = "width: 200px"></td>
    <td class = "ndeTable pointer border" onclick = "toggle( @paClass )" colspan = "1">
    @item.pa
    </td>           
</tr>

pa = item.pa;
}
</table>

I am going to continue trying to optimize the code in the meantime but if anyone has any tips or tricks I can use I would be very thankful as this has been troubling me for the past couple days and 45 secs for a small database is ridiculous. Thank you for your time. Cheers, James

最佳回答

点燃 s光仪/s光,并检查你在创建网页的单一http://www.un.org/www.un.org/Depts/index.html上所做的许多查询。 询问往往是业绩问题的责任。 仅仅使这种观点变得如此之久几乎是不可能的。

问题回答

你与谁合作? 较老的浏览器没有新手的 Java印业绩,而且你可以同时揭露或藏匿,这无疑是你问题的根源。

我同意关于老龄化问题的答案,即,这是一个很好的选择,可以减少你在一次路上提供的数据,或者你必须减少你同时披露的内容。 Java处死是瞬时的,在老的浏览器上,处决确实缓慢。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签