|
-
May 26th, 2008, 07:48 AM
#1
Thread Starter
Frenzied Member
[Resolved-ish][2008] WCF Service timing out randomly
I'm currently in the process of developing a forum system that uses a WCF server to get, process and store data.
For the most part, it works like a charm, I have a pretty basic 3-tier model running in the background on the service and using data contracts to access whatever functionality I need.
My problem is, that sometimes when getting data from my service, it just starts to hang, until it hits the 1 minute timeout, and I can't seem to figure out why.
I always ensure that my service proxy's are closed, and I've even tried creating a while loop that ran til the state of the proxy's connection was closed, as to insure the object wasn't cached or some crazy thing like that I couldn't control.
I've tried making a simple for loop(100 iterations), that calls a method on the service which returns a simple string - this it can do fast, with no problems what so ever.
So I thought it might have something to do with my database connectivity. It just seems rather unlikely, since I also always ensure I'm closing down my database connections(I use the same method to access a plethora of procedures in my database - look below):
Code:
public DataTable CallStoredProcedure(string ProcedureName, bool query)
{
FbDataReader fbRead = null;
var fbConn = new FbConnection(ConnectionString);
var cmd = new FbCommand(ProcedureName, fbConn);
cmd.CommandType = CommandType.StoredProcedure;
foreach (var arg in ProcedureArguments)
{
cmd.Parameters.Add(arg.Name, arg.Value);
}
cmd.Connection.Open();
try
{
if (query)
{
fbRead = cmd.ExecuteReader();
var dt = new DataTable();
dt.Load(fbRead);
return dt;
}
else
{
cmd.ExecuteNonQuery();
}
}
finally
{
ProcedureArguments.Clear();
cmd.Connection.Close();
while (cmd.Connection.State != ConnectionState.Closed) { }
}
return null;
}
I'm using a Firebird database, which my company has tried and tested in a production environment for several years without any problems.
Neither me, nor any of my colleagues can seem to figure this out, and it's rather frustrating.
Oh, one more thing - the problem seems to occur more frequently when I load my data through an AJAX update panel.
Any help or thoughts is greatly appreciated.
Last edited by vbNeo; May 26th, 2008 at 02:29 PM.
"Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
- Zack de la Rocha
Hear me roar.
-
May 26th, 2008, 08:05 AM
#2
Thread Starter
Frenzied Member
Re: [2008] WCF Service timing out randomly
Hmm - changing the binding type to basicHttpBinding instead of wsHttpBinding seems to help on the problem.
Does anyone know what directly causes this?
"Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
- Zack de la Rocha
Hear me roar.
-
May 26th, 2008, 02:19 PM
#3
Re: [2008] WCF Service timing out randomly
Your guess is as good as mine.
My guess is that the timeout is caused by the frequency of the requests combined with the overhead of using wsHttpBinding (it's more expensive to use ws-* calls than basic) had caused a lag somewhere which in turn caused the timeout. It's possible that the above factor combined with using AJAX which relies on a "slow" javascript DOM can sometimes cause this. Because you're using an UpdatePanel I am not sure if you have control over the ascynchronousness of the calls (whether it's set to true or false).
Now that I think about it, you hadn't guessed what I just said or you would have posted it. I guess this means that my guess is better than yours.
-
May 26th, 2008, 02:28 PM
#4
Thread Starter
Frenzied Member
Re: [2008] WCF Service timing out randomly
Hmm, that might just cause it, though it does seem somewhat unlikely. Thing is though that there are a lot of factors involved that I have no control over, so I guess I'm just gonna have to make do with the basicHttpBinding, I certainly do not want to stop using the AJAX functionality.
Oh, and by the way, I already guessed it - I just couldn't comprehend it before you brought it to a somewhat less... articulate level - anywho, my guess is as good as yours, if not better! And also, I rock!
Let's leave this one be, I'd like to think that for once, Microsoft screwed up and not me, though it probably isn't so. If nothing else, they're gonna iron it out in later versions of WCF.
Thanks for the input
"Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
- Zack de la Rocha
Hear me roar.
-
May 26th, 2008, 02:53 PM
#5
Re: [Resolved-ish][2008] WCF Service timing out randomly
The next time you post, consider it to be a guessing competition between us.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|