8
Answers

mvc 5 timeout

neel k

neel k

9y
915
1
Hi,
In mvc 5, I got a time out error. I  need to display 40,000 records.
 
Thanks,
-Neelima 
Answers (8)
0
Syed Shanu

Syed Shanu

NA 25.2k 3m 9y
0
neel k

neel k

NA 143 58.5k 9y
first time 40,000 records loading correctly when i click 2nd page again loading 40,000 records and showing out of memory exception.
0
Ramesh  Maruthi

Ramesh Maruthi

NA 6.1k 406.2k 9y
Hi Neelima,
 
 
So in this line 
 
dt = ds.Tables[0]   can you see 40 k records here ??
 
If your answer is yes 
 
Can you please see whether 10k records is also causing problem, by limiting your data-set to 10k as mentioned below .
 
dt =  ds.Tables[0];
dt = dt.AsEnumerable().Skip(0).Take(10000).CopyToDataTable();
 
0
neel k

neel k

NA 143 58.5k 9y
I am trying this below link , I am struck in the middle . can any one help me. its very urgent.
 
 
0
neel k

neel k

NA 143 58.5k 9y
I can post my controller code and view code, can you please change the code, I don't know threading concept.
 Controller code: 
 
public ActionResult RunReports(int? id)
{
DomainContext CurrentLoginUser = ActiveDirectory_AccessModel.GetUserDetails(); // Username
var userDetails = (from c in db.SP_GR_Get_Userdetails(CurrentLoginUser.DisplayName)
select c.user_roles).FirstOrDefault();
if (userDetails == null)
{
return RedirectToAction("NoAccess");
}
var runResult = (from c in db.tbl_GR_Reports
where c.Report_ID == id
select c).SingleOrDefault();
DataSet ds = new DataSet();
DataTable dt = new DataTable();
if (runResult != null)
{
Microsoft.Practices.EnterpriseLibrary.Data.Database salesworldDbConn = new SqlDatabase(runResult.Db_Connection);
DbCommand cmd = salesworldDbConn.GetSqlStringCommand(runResult.Query);
try
{
ds = salesworldDbConn.ExecuteDataSet(cmd);
}
finally
{
cmd.Dispose();
salesworldDbConn = null;
}
if (ds != null && ds.Tables.Count > 0)
{
dt = ds.Tables[0];
}
}
return View(dt);
}
 View Code:
 
@model System.Data.DataTable
@{
ViewBag.Title = "RunReport";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<script>
$(document).ready(function () {
$("#export").click(function (e) {
var grid = $("#grid").data("kendoGrid");
grid.saveAsExcel();
e.preventDefault();
});
});
</script>
<form id="frmRunReport">
<table style="border: 1px solid black;" width="900" align="center">
<tr>
<td colspan="2"></td>
</tr>
<tr>
<td colspan="2"></td>
</tr>
<tr>
<td style="font-weight:bold;color:#004b8d; padding-left:20px; font-size:x-large"></td>
</tr>
<tr id="ManageUsers_grid">
<td colspan="2">
<div>
@(Html.Kendo().Grid(Model)
.Name("grid")
.Scrollable()
.Columns(columns =>
{
columns.AutoGenerate(column =>
{
column.Width = "100px";
});
//columns.AutoGenerate(true);
})
.HtmlAttributes(new { style = "width: 900px;" })
//.Scrollable()
.Groupable()
.Filterable()
.Sortable(sortable => sortable.AllowUnsort(true).SortMode(GridSortMode.MultipleColumn))
//.Pageable(pageable => pageable
// .PageSizes(true)
// )
.Resizable(resize => resize.Columns(true))
.DataSource(dataSource => dataSource
.Ajax()
//.PageSize(20)
.ServerOperation(false)
)
)
</div>
</td>
</tr>
<tr>
<td colspan="2" style="vertical-align:central">
<div class="form-footer">
<button id="export" class="form-button">Export to Excel</button>
</div>
</td>
</tr>
</table>
</form>
 
0
Ramesh  Maruthi

Ramesh Maruthi

NA 6.1k 406.2k 9y
Can you break the task by using threading into 4 parts as 1 part 10,000 records , and write to excel file.
0
neel k

neel k

NA 143 58.5k 9y
Thanks for reply, I need to display 40,000 records and export these records to Excel. When I am trying to display the records i got system out of memory exception.
0
Ramesh  Maruthi

Ramesh Maruthi

NA 6.1k 406.2k 9y
Hi Nelima,
 
 
Can you elaborate ur issue a little more.
 
Where did you got the time out issue  ??