Click here to Skip to main content
13,145,068 members (54,067 online)
Rate this:
Please Sign up or sign in to vote.
Hi all, I ran into a problem the other day when the deployed started freezing up after a few database calls, where this didn't happen while in VS 2012, after a while I realized that each time a call was made a new connection was added to the connection pool. this is where im a bit stuck. To my understanding if the connection string stays the same its supposed to use the same connection already open in the pool , but this calls kept opening new connections until the pool was full, and there my app was sitting waiting for a connection to become available.

I have a little javascript class that makes syncronous calls rather async,
looks like this
DTMS.Web.Data.SynchronousJSONCall = function(location) {
    this._requestObject = window.XMLHttpRequest ? new XMLHttpRequest() : window.ActiveXObject ? new ActiveXObject("MSXML2.XMLHTTP.3.0") : "";
    if (this._requestObject == "")
        throw "Cannot Load XMLHttpRequest";
    this._Content_Type = "application/json; charset=utf-8";
    if (location)
        this._location = location + '/';
        this._location = "http://" + + (window.location.pathname.indexOf('.aspx') != -1 ? window.location.pathname : window.location.pathname + 'Default.aspx') + "/";
    this._Method = null;
    this._parameters = null;
DTMS.Web.Data.SynchronousJSONCall.prototype = {
    send: function(methodName, Parameters) {
        this._Method = methodName;
        this._parameters = Parameters;
        ////"POST", this._location + methodName, false);
        this._requestObject.setRequestHeader("Content-Type", this._Content_Type);
        var result = Sys.Serialization.JavaScriptSerializer.deserialize(this._requestObject.responseText, false);
        if (typeof (result.d) != 'undefined')
            return result.d;
            throw result.Message;

i instantiate the class and then call send with my method to call and parameters to send with,
on the C# side its a static [WebMethod] on the same page the call is done,

I overcame the whole connection pooling thing by adding a webservice page and moving all my static methods to there and made them not static, this seemed to solve the connection pooling thing.

so if anyone could please point me in the right direction as to why when the c# methods are static they add a new connection to the connection pool?
Posted 27-Feb-13 3:53am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.170915.1 | Last Updated 27 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100