Solved

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

Posted on 2009-05-11
6
998 Views
Last Modified: 2012-08-13
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.
0
Comment
Question by:DaveSkinner
  • 4
  • 2
6 Comments
 
LVL 7

Expert Comment

by:zwei
ID: 24354943
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.
0
 

Author Comment

by:DaveSkinner
ID: 24355168
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...
0
 
LVL 7

Expert Comment

by:zwei
ID: 24355338
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.
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

Author Comment

by:DaveSkinner
ID: 24356060
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.
0
 

Author Comment

by:DaveSkinner
ID: 24372244
Does anyone else have any suggestions?
0
 

Accepted Solution

by:
DaveSkinner earned 0 total points
ID: 24393213
This has resolved itself. I have genuinly changed nothing - it started working. I am starting to suspect a hardware issue on my machine. This can be closed.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now