Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# Javascript .NET4
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 + '/';
    else
        this._location = "http://" + window.location.host + (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;
        ////
        this._requestObject.open("POST", this._location + methodName, false);
        this._requestObject.setRequestHeader("Content-Type", this._Content_Type);
        this._requestObject.send(Parameters);
        var result = Sys.Serialization.JavaScriptSerializer.deserialize(this._requestObject.responseText, false);
        if (typeof (result.d) != 'undefined')
            return result.d;
        else
            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 4:53am

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

  Print Answers RSS
0 OriginalGriff 350
1 Jochen Arndt 150
2 PIEBALDconsult 110
3 Richard MacCutchan 105
4 Sergey Alexandrovich Kryukov 104
0 OriginalGriff 6,055
1 DamithSL 4,621
2 Maciej Los 4,087
3 Kornfeld Eliyahu Peter 3,500
4 Sergey Alexandrovich Kryukov 3,294


Advertise | Privacy | Mobile
Web02 | 2.8.141220.1 | Last Updated 27 Feb 2013
Copyright © CodeProject, 1999-2014
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