Solved

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

Posted on 2009-05-11
6
990 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 

Author Comment

by:DaveSkinner
Comment Utility
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
Comment Utility
Does anyone else have any suggestions?
0
 

Accepted Solution

by:
DaveSkinner earned 0 total points
Comment Utility
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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

772 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

12 Experts available now in Live!

Get 1:1 Help Now