Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8144439
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T13:22:33+00:00 2026-06-06T13:22:33+00:00

In my MVC application, I am using repeated ajax calls for each 10 secs.

  • 0

In my MVC application, I am using repeated ajax calls for each 10 secs. Sometimes after some amount of time the DB server gets disconnected from the application server and then there is a huge memory leakage in the browser where the application is running.

My code runs as,

I am using jquery.timer.js for repeated ajax calls for each 10 secs

function class1() {
}

class1.prototype. funtion1 = function () {
    $.ajax({
        type: "POST",
        url: "/TestContoller/ActionOne",
        success: function (result) {
            $('#DivActionOne').html(result);
        },
        traditional: true,
        error: function (req, status, error) {
        }
    });
}

//Likewise for funtion2, funtion3, funtion4, funtion5

var count = 0;
var timer = $.timer(function () {
    $('#counter').html(++count);
    var class1 = new class1();
    var funtionOne= class1.funtion1;
    var funtionTwo= class1.funtion2;
    var funtionThree= class1.funtion3;
    var funtionFour= class1.funtion4;
    var funtionFive= class1.funtion5;
    var currentSec = count;
    if ((currentSec % 10) == 0) {
        funtionOne ();
        funtionTwo ();
        funtionThree ();
        funtionFour ();
        funtionFive ();
    }
});
timer.set({ time: 1000, autostart: true });

When the connection got lost I checked the trace log and found the below error message:

Message: System.ServiceModel.CommunicationException: The underlying connection was closed: A connection that was expected to be kept alive was closed by the server. —> System.Net.WebException: The underlying connection was closed: A connection that was expected to be kept alive was closed by the server. —> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. —> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
— End of inner exception stack trace —
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.PooledStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.Connection.SyncRead(HttpWebRequest request, Boolean userRetrievedStream, Boolean probeRead)
— End of inner exception stack trace —
at System.Net.HttpWebRequest.GetResponse()
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
— End of inner exception stack trace —

Please help me in sorting this out.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T13:22:34+00:00Added an answer on June 6, 2026 at 1:22 pm

    Because you’re using a timer and not calling the next ajax request on the previous ajax calls callback function. Unless you setup your web server to be treated like a web garden (allow simultaneous requests) then you will need to wait until each one is finished before going to the next one.

    Put your ajax call in a function, then call the function in your success callback so it runs again when its finished.

    Of course you would need to set up some type of variable determining if its finished or not so it doesn’t loop infinitely.

    Anything beyond that, would require server side optimization.

    Something like this should work, without prototype of course, because i’ve never used prototype, but here it is without it:

      thecount = 0;       
        function class1() { 
            $.ajax({
                type: "POST",
                url: "/TestContoller/ActionOne",
                success: function (result) {
                    $('#DivActionOne').html(result);                    
                    thecount++1;                    
                    if (thecount < 5) { class1(); }                    
                },
                traditional: true,
                error: function (req, status, error) {
                }
            });            
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've made some graphs in my ASP.Net MVC application using the ASP.Net MSChart control.
What are the licences required for an asp.net (MVC) web application using sql server
I am working on an MVC application using Entity Framework. After creating an EDMX,
I'm writing an ASP.Net MVC application using Jquery to post some data to my
I am developing an MVC application using nHibernate; running through VS's built in web
I have a PHP MVC application using Zend Framework. As presented in the quickstart,
I have an ASP.NET MVC application using Authorization Attributes on Controllers and Actions. This
I have a ASP.NET MVC application using NHibernate and the application runs fine when
I am creating an editor in asp.net MVC application using ckeditor. In textarea i
I am uploading a file in my ASP.NET MVC application using Uploadify. Controller: public

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.