I have a Winforms appplication written in C# that consumes web services from a Windows 2008 IIS Coldfusion server. All the web service calls succeed but one, which fails about 50% of the time with the following error:
System.InvalidOperationException was unhandled by user code Message=There is an error in XML document (1254, 7).
with an inner exception of:
InnerException: System.IO.IOException Message=Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
I checked my IIS logs and I get a 503 error (Service Unavailable) and an IIS code of 64 (The specified network is no longer available). Any suggestions would be great.
I run my web service in SOAP UI and I get the following error:
javax.net.ssl.SSLException: Connection has been shutdown: javax.net.ssl.SSLException: java.net.SocketException: Connection reset
This code works fine at one company but this error pops up almost every time for this company I'm currently working with.
I'm not sure this is applicable to the OP's specific situation, but this may help others who arrive here nowadays. One potential cause for this exception involves mismatched security protocols. If the server you're calling requires TLS 1.2 and you're using an older version of ASP.net (<= Version 4.0) you will be using an older security protocol to make your calls unless you change it. You can force ASP.net to use TLS 1.2 (shown below). This can be done anywhere in the application, but I put it just before the line that calls the web service requiring TLS 1.2:
using System.Net;
...
//Enable TLS 1.2
ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
// Call the Web Service that requires TLS 1.2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With