Link to home
Start Free TrialLog in
Avatar of DaveSkinner
DaveSkinnerFlag for United States of America

asked on

Web Service in c#, VS 2008 - System.Net.WebException: The underlying connection was closed

I have suddenly started getting this error in our project. I am currently the only one who gets it, but I am unsure when it started happening, which is making it very difficult to track down whatever has been changed.

System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send. --->
System.IO.IOException: Unable to write data to the transport connection: The system detected an invalid pointer address in attempting to use a pointer argument in a call. --->
System.Net.Sockets.SocketException: The system detected an invalid pointer address in attempting to use a pointer argument in a call
at System.Net.Sockets.Socket.MultipleSend(BufferOffsetSize[] buffers, SocketFlags socketFlags)
   at System.Net.Sockets.NetworkStream.MA first chance exception of type 'System.Net.WebException' occurred in System.Web.Services.dll

I am connecting to a Web Service, using c#. The Web Service is written in Java. I am succussfully loading data from it, but when I try to send data back, I get this error. I have tried all the suggestions I have found in this site, so I am now also doing:

protected override System.Net.WebRequest GetWebRequest(Uri uri)
        {
            System.Net.HttpWebRequest rval = base.GetWebRequest(uri) as System.Net.HttpWebRequest;

            if (rval != null)
            {
                rval.KeepAlive = false;
                rval.ProtocolVersion = HttpVersion.Version10;
            }

            return rval;
        }

but with no success.

Can anyone help (I have also disabled the firewall on my machine, to see if that helped - it didn't).

Many thanks.
Avatar of zwei
zwei
Flag of Sweden image

Don't know if this helps but MSDN says:

The system detected an invalid pointer address in attempting to use a pointer argument of a call. This error occurs if an application passes an invalid pointer value, or if the length of the buffer is too small. For instance, if the length of an argument, which is a sockaddr structure, is smaller than the sizeof(sockaddr).

So it sounds like the buffer needs to be larger.
Avatar of DaveSkinner

ASKER

I am just using the standard Web Service feature of VS 2008, so I don't currently have much control at the level you are speaking about.

Although if that is what it takes...
I think I found the source of your problem:

http://ph.answers.yahoo.com/question/index?qid=1006050816011

It describes the error when translating a virtual address to a physical one. As for the solution, I'm not sure. It seems to only happen to certain machines. Try updating/installing the same windows/software that the other people are using.

Sorry, maybe someone else can help.
I hope so - dont think I follow that particular explanation! Thanks for your suggestions though, I am speaking to a couple of people here who may know what all that means.
Does anyone else have any suggestions?
ASKER CERTIFIED SOLUTION
Avatar of DaveSkinner
DaveSkinner
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial