all groups > dotnet web services > november 2007 >
You're in the

dotnet web services

group:

WCF : Underlying connection was closed


WCF : Underlying connection was closed Arnaud Viscusi
11/26/2007 1:32:01 AM
dotnet web services:
Hi all,

we meet a problem since we use WCF to consume java WebServices.
Often the first call works then the second raises the following error :
"The underlying connection was closed : "

We use a basicHttpBinding over HTTPS to connect to WebService. The
configuration is the following
<binding name="SoapBinding" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:02:00"
allowCookies="false"
bypassProxyOnLocal="false"
hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536000" maxBufferPoolSize="524288"
maxReceivedMessageSize="65536000"
messageEncoding="Text" textEncoding="utf-8"
transferMode="Buffered" useDefaultWebProxy="true" >

<readerQuotas maxDepth="32" maxStringContentLength="8192"
maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="Transport">
<transport clientCredentialType="None"
proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName"
algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>

We found some solution about the "KeepAlive" property of the generated proxy
but it concerns "standard" webservice. We don't know how to reproduce this on
WCF client.

Is there a solution with Binding configuration or with code ?

Thanks
RE: WCF : Underlying connection was closed Arnaud Viscusi
11/27/2007 1:22:02 AM
Hi Steven,

the first call always works and terminates correctly and we get the good
response.
Then the error on the second call occurs randomely.
The exact error is :
"The underlying connection was closed: A connection that was expected to be
kept alive was closed by the server"

We found the following solution concerning this error but it's about
"standard" webservice (not WCF) :

protected override WebRequest GetWebRequest(Uri uri)
{
HttpWebRequest webRequest = (HttpWebRequest)
base.GetWebRequest(uri);

webRequest.KeepAlive = false;
webRequest.ProtocolVersion=HttpVersion.Version10;
return webRequest;
}

http://geekswithblogs.net/denis/archive/2005/08/16/50365.aspx

Do you think there's a way to accomplish this with WCF ? Or is it a problem
with our configuration ? Could the problem come from the JAVA side ?

Thanks

[quoted text, click to view]
RE: WCF : Underlying connection was closed stcheng@online.microsoft.com
11/27/2007 4:39:12 AM
Hi Arnaud,

From your description, you're using WCF basic httpbinding to consume a JAVA
webservice, however, you found the service call will always report error
"underlying connection closed..." after the first method call, correct?

As for this issue, based on my experience, it is likely the underlying soap
request(from WCF to JAVA side) or the soap response(from JAVA side to WCF)
doesn't quite meet the receiver's expected format. As you said the problem
occur after the first method call, does it occur after you make the
webservice call and haven't get the correcct response result. Or does it
occur when you make the second webservice call?

If the first call finish completely, then, is there any particular
difference between the two ones or maybe the second one may take a long
runtime time? If the problem can be isolated to method specific, we can
then concentrate on that particular webmethod.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.



--------------------
From: =?Utf-8?B?QXJuYXVkIFZpc2N1c2k=?= <ho.aviscusi@newsgroup.nospam>
Subject: WCF : Underlying connection was closed
Date: Mon, 26 Nov 2007 01:32:01 -0800


Hi all,

we meet a problem since we use WCF to consume java WebServices.
Often the first call works then the second raises the following error :
"The underlying connection was closed : "

We use a basicHttpBinding over HTTPS to connect to WebService. The
configuration is the following
<binding name="SoapBinding" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:02:00"
allowCookies="false"
bypassProxyOnLocal="false"
hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536000" maxBufferPoolSize="524288"
maxReceivedMessageSize="65536000"
messageEncoding="Text" textEncoding="utf-8"
transferMode="Buffered" useDefaultWebProxy="true" >

<readerQuotas maxDepth="32" maxStringContentLength="8192"
maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="Transport">
<transport clientCredentialType="None"
proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName"
algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>

We found some solution about the "KeepAlive" property of the generated
proxy
but it concerns "standard" webservice. We don't know how to reproduce this
on
WCF client.

Is there a solution with Binding configuration or with code ?

RE: WCF : Underlying connection was closed stcheng@online.microsoft.com
11/29/2007 8:36:58 AM
Thanks for your reply Arnaud,

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.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
From: =?Utf-8?B?QXJuYXVkIFZpc2N1c2k=?= <ho.aviscusi@newsgroup.nospam>
References: <B9075E39-6092-4254-91F7-F031D224F8EA@microsoft.com>
<jDox$9KMIHA.5204@TK2MSFTNGHUB02.phx.gbl>
Subject: RE: WCF : Underlying connection was closed
Date: Tue, 27 Nov 2007 01:22:02 -0800

Hi Steven,

the first call always works and terminates correctly and we get the good
response.
Then the error on the second call occurs randomely.
The exact error is :
"The underlying connection was closed: A connection that was expected to be
kept alive was closed by the server"

We found the following solution concerning this error but it's about
"standard" webservice (not WCF) :

protected override WebRequest GetWebRequest(Uri uri)
{
HttpWebRequest webRequest = (HttpWebRequest)
base.GetWebRequest(uri);

webRequest.KeepAlive = false;
webRequest.ProtocolVersion=HttpVersion.Version10;
return webRequest;
}

http://geekswithblogs.net/denis/archive/2005/08/16/50365.aspx

Do you think there's a way to accomplish this with WCF ? Or is it a problem
with our configuration ? Could the problem come from the JAVA side ?

Thanks

[quoted text, click to view]
RE: WCF : Underlying connection was closed ClaudIrim
2/6/2008 3:33:06 AM
I solved this problem with my web services by calling Discover() method:

YourWebService ws = new YourWebService ();
ws.Discover();

just before calling the service webmethods


AddThis Social Bookmark Button