473,406 Members | 2,467 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

need help desperately. The underlying connection was closed:

i'm having a very strange problem, i've been fighting it for more than 3
weeks. I am using WSE 3.0 t ocall a third party website, but when i call a
method through the proxy object i get NO RESPONSE at all just this exception:

The underlying connection was closed: An unexpected error occurred on a send.

however if i take the EXACT SAME soap request and headers generated by the
webservice and enter it into a product like SoapScope, and run it there, i
get a response. (the url in here is the one i am having a problem with, if
anybody wants to experiment

HttpWebRequest myReq =

(HttpWebRequest)WebRequest.Create("https://www.tpvs.hmrc.gov.uk/dpsauthentication/dpsauthentication.jws");
myReq.GetResponse();
so i decided to go lower level, and just communicate with the site via a
HttpWebRequest or WebClient , (as if you go to the site with the browser
you;'ll get a HTML reply at least.. i just want SOME reply).. however even
simple things like the following give the same error.

WebClient wc = new WebClient();

wc.DownloadString("https://www.tpvs.hmrc.gov.uk/dpsauthentication/dpsauthentication.jws");

this leads me to believe the issue is at a much lower level than WSE 3.0, or
SOAP itself. but i don't know what to do. i've tried the advice on the
newsgroups for this error with .Keepalive to no avail. and also this
System.Net.ServicePointManager.ServerCertificateVa lidationCallback +=
delegate(object sender2, X509Certificate certificate,
X509Chain chain, SslPolicyErrors sslPolicyErrors)
{
MessageBox.Show("dude");
bool validationResult = true;
return validationResult;
};

but it never gets called.

in need of desperate help.
Karl Prosser
Mar 9 '06 #1
5 5868
the plot thickens, even when its not a websevice (there is another service
provided by the same place which you just submit POST stuff https and i get
the same errors)

:(
i really need help.
here is a snippet:
HttpWebRequest myReq =

(HttpWebRequest)WebRequest.Create("https://www.tpvs.hmrc.gov.uk/EOY/post.slt");
myReq.KeepAlive = true;
myReq.Method = "POST";
myReq.ContentType = "txt/xml; charset=utf-8";
myReq.Timeout = 10000;
//myReq.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; MS Web
Services Client Protocol 2.0.50727.42) (Mindreef SOAPscope 4.1.12095)";
UTF8Encoding encoding = new UTF8Encoding();
byte[] byte1 = encoding.GetBytes (textBox1.Text);

Stream requeststream = myReq.GetRequestStream();
requeststream.Write(byte1, 0, byte1.Length);
requeststream.Close();

WebResponse myResponse = myReq.GetResponse();

its all good until the last line, where i get the same error.

Mar 10 '06 #2
I've narrowed it down any further.

the httpwebclient and webclient BOTH work fine, without this error on dotnet
1.1 in visual studio 2003, but fail miserably with this error on visual
studio 2005, i don't know if this is a bug of the dotnet 2.0 framework, the
webservice provider not implementing a protocol as strict as it should be, or
a setting i can set to override this behaviour.

Karl
Mar 11 '06 #3

microsoft support helped me solve this problem. The problem in essence
was the maker of the server code , did not specify which SSL protocol
they were using, and with dotnet 2.0 the dfeault is TLS, while the
server was actually using SSL3..

so basically what i had to do, is before creating any of the
communication objects run this line of code
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;

which in essence specifies the security protocol at a low level
(sockets) level, so it works no matter whether tie client object you
are using is a httpwebrequest, webclient , or webservice proxy class
generated by visual studio , or web services security extention 3
(WSE3) as is in my case.
I hope that putting this post out there, may help some other frustrated
coder in the future.

Mar 15 '06 #4
Wow! I have just been having the EXACT SAME PROBLEM, with the EXACT
SAME SERVICE (DPS).

Feel free to email me directly if you have other issues that I may be
able to help you with. I owe you one.

Mar 19 '06 #5
Have any of you good folks actually now achieved successful communication with the DPS. Apart from the connection problems, we are continually experiencing lots of nasty things relating to the xml that dps is actually sending back to us. The service seems both weird and flakey in its implementation - unless of course we are just being idiots, failing to understand how to work with it properly.

So, are others now using dps successfully, or are you folks also pulling your hair out in a mass of problems?
Apr 7 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

26
by: Rajeev Tipnis | last post by:
http://support.microsoft.com/default.aspx?scid=kb;en- us;819450 Questions: 1) Is this patch (fix) applicable to the .NET 1.1 Framework as well? That is, if we have Framework 1.1 (On...
3
by: MattM | last post by:
I am getting the "The underlying connection was closed: Unable to connect to the remote server" message when trying to connect an ASPX page to a simple Hello World web service. I have read a few...
5
by: Vijayakrishna Pondala | last post by:
Hi, We are using the following error randomly, when accessing a webservice method/servlet hosted on JBoss application server: The underlying connection was closed: An unexpected error occurred...
4
by: Matthew.DelVecchio | last post by:
hello, i am developing an ASP.NET web app that consumes a 3rd party vendor webservice. it is my first one so while ive done my homework, im not an expert on the matter. our partner's...
2
by: hazz | last post by:
Dim ws As New GetInfoByZIP.USZip works great if I have an internet connection on my dev machine. As soon as I lose or disable my internet connection I get "The underlying connection was...
3
by: Rahul Anand | last post by:
As per our requirements we have a web service which internally connects (Simple HTTP Post Request) to a remote server to initiate some work. We are calling the web service method asynchronously...
0
by: imonline | last post by:
Hi, I have created a asp.net page which posts XML on the web service using .net 2.0. The page and the webservice was working fine but once I converted them to .net 3.5 I have been getting...
0
by: imonline | last post by:
Hi, I have created a asp.net page which posts XML on the web service using .net 2.0. The page and the webservice was working fine but once I converted them to .net 3.5 I have been getting...
4
by: Sin Jeong-hun | last post by:
I don't get the message so it's hard to debug that, but some of my clients report that they get "The underlying connection was closed unexpectedly" exception. According to this site (http://...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.