Chinh Do

WCF Client Error “The connection was closed unexpectedly” Calling Java/WebSphere 7 Web Service

23rd January 2010

WCF Client Error “The connection was closed unexpectedly” Calling Java/WebSphere 7 Web Service

If you get the following exception calling a WebSphere web service from your .NET WCF Client (service reference):

System.ServiceModel.CommunicationException: The underlying connection was closed: The connection was closed unexpectedly. —>  System.Net.WebException: The underlying connection was closed: The connection was closed unexpectedly.

Try adding this code before the service call:

System.Net.ServicePointManager.Expect100Continue = false;

More info on the 100-Continue behavior from MSDN.

This entry was posted on Saturday, January 23rd, 2010 at 9:31 pm and is filed under Dotnet/.NET - C#, Java, Programming. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

There are currently 2 responses to “WCF Client Error “The connection was closed unexpectedly” Calling Java/WebSphere 7 Web Service”

  1. 1 On June 10th, 2010, Camilo said:

    Thanks a lot dude. You “save my life” :)

  2. 2 On June 10th, 2010, Chinh Do said:

    Camilo: I appreciate the note. Chinh

Leave a Comment

  • Calendar

  • January 2010
    M T W T F S S
    « Dec   Feb »
     123
    45678910
    11121314151617
    18192021222324
    25262728293031