RE: WCF : Underlying connection was closed

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



{\rtf1\ansi\ansicpg936\deff0\deflang1033\deflangfe2052{\fonttbl{\f0\fnil\fprq2\fcharset0 MS Sans Serif;}}
\viewkind4\uc1\pard\lang2052\f0\fs20 Thanks for your reply Arnaud,
\par
\par So far from such appearnce behavior, it's difficult to determine the exact cause. If the first and second webmethods call doesn't have particular difference(e.g. you can still get the same behavior even if you call the same method twice), you may capture the XML soap message to inspect whether the two method calls have different underlying XML soap messages. Since raw xml maybe complex, it is recommend that you try repro the problem through two simplified webservice methods.
\par
\par Sincerely,
\par
\par Steven Cheng
\par
\par Microsoft MSDN Online Support Lead
\par
\par
\par This posting is provided "AS IS" with no warranties, and confers no rights.
\par
\par \pard\li720 --------------------
\par From: =?Utf-8?B?QXJuYXVkIFZpc2N1c2k=?= <ho.aviscusi@xxxxxxxxxxxxxxxx>
\par References: <B9075E39-6092-4254-91F7-F031D224F8EA@xxxxxxxxxxxxx> <jDox$9KMIHA.5204@xxxxxxxxxxxxxxxxxxxxxx>
\par Subject: RE: WCF : Underlying connection was closed
\par Date: Tue, 27 Nov 2007 01:22:02 -0800
\par
\par Hi Steven,
\par
\par the first call always works and terminates correctly and we get the good
\par response.
\par Then the error on the second call occurs randomely.
\par The exact error is :
\par "The underlying connection was closed: A connection that was expected to be
\par kept alive was closed by the server"
\par
\par We found the following solution concerning this error but it's about
\par "standard" webservice (not WCF) :
\par
\par protected override WebRequest GetWebRequest(Uri uri)
\par \{
\par HttpWebRequest webRequest = (HttpWebRequest)
\par base.GetWebRequest(uri);
\par
\par webRequest.KeepAlive = false;
\par webRequest.ProtocolVersion=HttpVersion.Version10;
\par return webRequest;
\par \}
\par
\par http://geekswithblogs.net/denis/archive/2005/08/16/50365.aspx
\par
\par Do you think there's a way to accomplish this with WCF ? Or is it a problem
\par with our configuration ? Could the problem come from the JAVA side ?
\par
\par Thanks
\par
\par "Steven Cheng[MSFT]" wrote:
\par
\par > Hi Arnaud,
\par >
\par > From your description, you're using WCF basic httpbinding to consume a JAVA
\par > webservice, however, you found the service call will always report error
\par > "underlying connection closed..." after the first method call, correct?
\par >
\par > As for this issue, based on my experience, it is likely the underlying soap
\par > request(from WCF to JAVA side) or the soap response(from JAVA side to WCF)
\par > doesn't quite meet the receiver's expected format. As you said the problem
\par > occur after the first method call, does it occur after you make the
\par > webservice call and haven't get the correcct response result. Or does it
\par > occur when you make the second webservice call?
\par >
\par > If the first call finish completely, then, is there any particular
\par > difference between the two ones or maybe the second one may take a long
\par > runtime time? If the problem can be isolated to method specific, we can
\par > then concentrate on that particular webmethod.
\par >
\par > Sincerely,
\par >
\par > Steven Cheng
\par >
\par > Microsoft MSDN Online Support Lead
\par >
\par >
\par >
\par > ==================================================
\par >
\par > Get notification to my posts through email? Please refer to
\par > http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
\par > ications.
\par >
\par >
\par >
\par > Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
\par > where an initial response from the community or a Microsoft Support
\par > Engineer within 1 business day is acceptable. Please note that each follow
\par > up response may take approximately 2 business days as the support
\par > professional working with you may need further investigation to reach the
\par > most efficient resolution. The offering is not appropriate for situations
\par > that require urgent, real-time or phone-based interactions or complex
\par > project analysis and dump analysis issues. Issues of this nature are best
\par > handled working with a dedicated Microsoft Support Engineer by contacting
\par > Microsoft Customer Support Services (CSS) at
\par > http://msdn.microsoft.com/subscriptions/support/default.aspx.
\par >
\par > ==================================================
\par > \tab
\par >
\par > This posting is provided "AS IS" with no warranties, and confers no rights.
\par >
\par >
\par >
\par > --------------------
\par > From: =?Utf-8?B?QXJuYXVkIFZpc2N1c2k=?= <ho.aviscusi@xxxxxxxxxxxxxxxx>
\par > Subject: WCF : Underlying connection was closed
\par > Date: Mon, 26 Nov 2007 01:32:01 -0800
\par >
\par >
\par > Hi all,
\par >
\par > we meet a problem since we use WCF to consume java WebServices.
\par > Often the first call works then the second raises the following error :
\par > "The underlying connection was closed : "
\par >
\par > We use a basicHttpBinding over HTTPS to connect to WebService. The
\par > configuration is the following
\par > <binding name="SoapBinding" closeTimeout="00:01:00" openTimeout="00:01:00"
\par > receiveTimeout="00:10:00" sendTimeout="00:02:00"
\par > allowCookies="false"
\par > bypassProxyOnLocal="false"
\par > hostNameComparisonMode="StrongWildcard"
\par > maxBufferSize="65536000" maxBufferPoolSize="524288"
\par > maxReceivedMessageSize="65536000"
\par > messageEncoding="Text" textEncoding="utf-8"
\par > transferMode="Buffered" useDefaultWebProxy="true" >
\par > \tab\tab\tab
\par > \tab\tab <readerQuotas maxDepth="32" maxStringContentLength="8192"
\par > maxArrayLength="16384"
\par > maxBytesPerRead="4096" maxNameTableCharCount="16384" />
\par > <security mode="Transport">
\par > <transport clientCredentialType="None"
\par > proxyCredentialType="None" realm="" />
\par > <message clientCredentialType="UserName"
\par > algorithmSuite="Default" />
\par > </security>
\par > </binding>\tab
\par > </basicHttpBinding>
\par >
\par > We found some solution about the "KeepAlive" property of the generated
\par > proxy
\par > but it concerns "standard" webservice. We don't know how to reproduce this
\par > on
\par > WCF client.
\par >
\par > Is there a solution with Binding configuration or with code ?
\par >
\par > Thanks
\par >
\par >
\par \pard
\par
\par }

Relevant Pages