I have a strange problem. when i call the function below a couple of times in a row (not sure of its always 2 times), the server responds with a timeout. The first call responds fine.
My code looks like this:
private void TaminoUpdate(TaminoUri uri, XmlDocument doc, string collection)
TaminoUserInfo info = new TaminoUserInfo(“User”,“Pwd”);
TaminoConnection connection = new TaminoConnection(“http://MyServer/tamino/MyColl”, info);
TaminoCommand command =connection.CreateCommand(collection);
TaminoResponse response = command.Update(uri, new TaminoDocument(doc));
//TODO: read and handle the response.
Did I miss out some cleanup-instructions? Any help would be appreceated.
Thanks in advance…
The code looks OK. Though I must admit I would expect TaminoConnection to be a long lived object and not created for every operation.
Unfortunately there’s not much info here. When you say the “server responds with a timeout” I assume that you receive a Tamino error? If that is the case what is the TaminoResponse: ReturnValue, ErrorText + XmlDocument.OuterXml?
Or do you get an exception? If that is the case what is the stack trace?
Ok, it seems it might be a problem opening and closing the connection at every operation. It is actually not the update-command that generates the timeout, but instead a following GetElement command. I get a timeout exception on the SoftwareAG.Tamino.Api.Common.Command.Execute().
I am wondering whether the following problem may be related to your issue? You could try the suggestion to see if it helps.
Thanks for the suggestions. It seems like all I had to do was set the ServicePointManager.DefaultConnectionLimit to something like 10 (higher than before) and ServicePointManager.MaxServicePointIdleTime to 500 milliseconds (lower than before). Apparently whenever i perform an Update as described earlyer, the connection is kept open until timeout, and therefore I ran out of available servicepoints.
This still means that if i make 10 updates within 5 seconds, I will get a timeout exeption as before. Not really a great solution, but thats the only workaround i could figure out.
It is also possible that it may be related to the KeepAlive setting in the web server. It could be this that is holding the connections open?