Solved

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

Posted on 2009-05-11
6
1,028 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

 

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Here I am going to explain creating proxies at runtime for WCF Service. So basically we use to generate proxies using Add Service Reference and then giving the Url of the WCF service then generate proxy files at client side. Ok, what if something ge…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …

710 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