0

A transport-level error has occurred when receiving results from the server. (provider: Session Provider, error: 19 - Physical connection is not usable)

I am using entity framework but I got this error. I am using visual studio 2012 (MVC)and SQL Server 2012.

public JsonResult LineChart()
{
    List<AssetMigrationDetails> listDashBoard = new List<AssetMigrationDetails>();
    decimal sumTotal = 0;
    try
    {
          demoEntities2 objentity = new demoEntities2();
          var _objdBoard = (from data in objentity.tbl_dashboard
                               select new
                               {
                                   data.id
                               }).Count();

        sumTotal = Convert.ToDecimal(_objdBoard.ToString());

        var _objuserdetail = (from data in objentity.tbl_dashboard
                              where (data.isMigrated == "Y" && data.migrationdate <= System.DateTime.Now)
                              group data by EntityFunctions.TruncateTime(data.migrationdate) into k
                              select new
                              {
                                  date = k.Key,
                                  count = k.Count()
                              });

        foreach (var item in _objuserdetail)
        {
            AssetMigrationDetails objAsset = new AssetMigrationDetails();
            objAsset.Completion = (Convert.ToDecimal(item.count) / sumTotal) * 100;
            listDashBoard.Add(objAsset);

        }

        decimal sum = 0;
        decimal sum1 = 0;
        for (var i = 0; i < listDashBoard.Count(); i++)
        {
            sum = sum + Convert.ToDecimal(listDashBoard[i].Completion);
            sum1 = decimal.Parse(sum.ToString("0.00"));
            listDashBoard[i].Completion = sum1;
        }

        }

        catch (Exception ex)
        {
            var msg=ex.Message;
        }
        return Json(listDashBoard, JsonRequestBehavior.AllowGet);
 }
shanmu
  • 31
  • 3
  • 11
  • this error i am not getting frequently..this error few times only .If any one know help me. – shanmu Jun 30 '16 at 10:29
  • Check This: http://stackoverflow.com/questions/2962927/a-transport-level-error-has-occurred-when-receiving-results-from-the-server or this https://forums.iis.net/t/1202952.aspx – Shashank Sood Jun 30 '16 at 11:36

1 Answers1

0

Replace Your Jquery for Auto Refresh

 $(document).ready(
              function () {
                  setInterval(function () {
                      $(".status").change();
                  }, 10000);
              });

Instead of .status you can use Your class name or id names

Azhar Ebrahim
  • 27
  • 1
  • 2
  • 9
  • my auto refresh code is working fine.while run my vs if it is too idle for long time that time only i got that error – shanmu Jun 30 '16 at 11:03
  • $(function () { setInterval(function () { loadLineChartData(); },10000); }); – shanmu Jun 30 '16 at 11:04