Getting an occasional error calling WebServices
I have a ClickOnce app that calls WebServices on the server (standard ASMX style, not WCF). Occasionally, the users get this error:
System.Reflection.TargetInvocationException: An exception occurred during the operation, making the result invalid. Check InnerException for exception details.
System.Net.WebException: Unable to connect to the remote server System.Net.Sockets.SocketException: A connect request was made on an alr开发者_高级运维eady connected socket
This occurs fairly rarely (10-20 times a day out of nearly a million calls), but still enough that users complain about it once in a while.
The server is a standard Windows 2003 R2 with IIS.
What could be the issue here?
You may want to check that you implenting the a Using Statement around your call, there client handles only six threads out, this could cause the webservice to refuse the call.
using (var proxy = new ApplicationWebService.ApplicationWebService())
{
proxy.Method();
}
If this does not work, you may want to think about calling the webservice via aync.
Cheers
精彩评论