By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,967 Members | 1,625 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,967 IT Pros & Developers. It's quick & easy.

WCF : Underlying connection was closed

P: n/a
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

Nov 26 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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/subscripti...ult.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/subscripti...t/default.aspx.

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

--------------------
From: =?Utf-8?B?QXJuYXVkIFZpc2N1c2k=?= <ho*********@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 ?

Thanks
Nov 27 '07 #2

P: n/a
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/arch.../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

"Steven Cheng[MSFT]" wrote:
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/subscripti...ult.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/subscripti...t/default.aspx.

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

--------------------
From: =?Utf-8?B?QXJuYXVkIFZpc2N1c2k=?= <ho*********@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 ?

Thanks

Nov 27 '07 #3

P: n/a
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*********@newsgroup.nospam>
References: <B9**********************************@microsoft.co m>
<jD**************@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/arch.../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

"Steven Cheng[MSFT]" wrote:
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/subscripti...ult.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/subscripti...t/default.aspx.

==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.
>
--------------------
From: =?Utf-8?B?QXJuYXVkIFZpc2N1c2k=?= <ho*********@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 ?

Thanks

Nov 29 '07 #4

P: n/a
I solved this problem with my web services by calling Discover() method:

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

just before calling the service webmethods

Feb 6 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.