473,769 Members | 2,365 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

WCF : Underlying connection was closed

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 basicHttpBindin g over HTTPS to connect to WebService. The
configuration is the following
<binding name="SoapBindi ng" closeTimeout="0 0:01:00" openTimeout="00 :01:00"
receiveTimeout= "00:10:00" sendTimeout="00 :02:00"
allowCookies="f alse"
bypassProxyOnLo cal="false"
hostNameCompari sonMode="Strong Wildcard"
maxBufferSize=" 65536000" maxBufferPoolSi ze="524288"
maxReceivedMess ageSize="655360 00"
messageEncoding ="Text" textEncoding="u tf-8"
transferMode="B uffered" useDefaultWebPr oxy="true" >

<readerQuotas maxDepth="32" maxStringConten tLength="8192"
maxArrayLength= "16384"
maxBytesPerRead ="4096" maxNameTableCha rCount="16384" />
<security mode="Transport ">
<transport clientCredentia lType="None"
proxyCredential Type="None" realm="" />
<message clientCredentia lType="UserName "
algorithmSuite= "Default" />
</security>
</binding>
</basicHttpBindin g>

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
4 21804
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?QXJuYXVkIFZ pc2N1c2k=?= <ho*********@ne wsgroup.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 basicHttpBindin g over HTTPS to connect to WebService. The
configuration is the following
<binding name="SoapBindi ng" closeTimeout="0 0:01:00" openTimeout="00 :01:00"
receiveTimeout= "00:10:00" sendTimeout="00 :02:00"
allowCookies="f alse"
bypassProxyOnLo cal="false"
hostNameCompari sonMode="Strong Wildcard"
maxBufferSize=" 65536000" maxBufferPoolSi ze="524288"
maxReceivedMess ageSize="655360 00"
messageEncoding ="Text" textEncoding="u tf-8"
transferMode="B uffered" useDefaultWebPr oxy="true" >

<readerQuotas maxDepth="32" maxStringConten tLength="8192"
maxArrayLength= "16384"
maxBytesPerRead ="4096" maxNameTableCha rCount="16384" />
<security mode="Transport ">
<transport clientCredentia lType="None"
proxyCredential Type="None" realm="" />
<message clientCredentia lType="UserName "
algorithmSuite= "Default" />
</security>
</binding>
</basicHttpBindin g>

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
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(U ri uri)
{
HttpWebRequest webRequest = (HttpWebRequest )
base.GetWebRequ est(uri);

webRequest.Keep Alive = false;
webRequest.Prot ocolVersion=Htt pVersion.Versio n10;
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?QXJuYXVkIFZ pc2N1c2k=?= <ho*********@ne wsgroup.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 basicHttpBindin g over HTTPS to connect to WebService. The
configuration is the following
<binding name="SoapBindi ng" closeTimeout="0 0:01:00" openTimeout="00 :01:00"
receiveTimeout= "00:10:00" sendTimeout="00 :02:00"
allowCookies="f alse"
bypassProxyOnLo cal="false"
hostNameCompari sonMode="Strong Wildcard"
maxBufferSize=" 65536000" maxBufferPoolSi ze="524288"
maxReceivedMess ageSize="655360 00"
messageEncoding ="Text" textEncoding="u tf-8"
transferMode="B uffered" useDefaultWebPr oxy="true" >

<readerQuotas maxDepth="32" maxStringConten tLength="8192"
maxArrayLength= "16384"
maxBytesPerRead ="4096" maxNameTableCha rCount="16384" />
<security mode="Transport ">
<transport clientCredentia lType="None"
proxyCredential Type="None" realm="" />
<message clientCredentia lType="UserName "
algorithmSuite= "Default" />
</security>
</binding>
</basicHttpBindin g>

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
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?QXJuYXVkIFZ pc2N1c2k=?= <ho*********@ne wsgroup.nospam>
References: <B9************ *************** *******@microso ft.com>
<jD************ **@TK2MSFTNGHUB 02.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(U ri uri)
{
HttpWebRequest webRequest = (HttpWebRequest )
base.GetWebRequ est(uri);

webRequest.Keep Alive = false;
webRequest.Prot ocolVersion=Htt pVersion.Versio n10;
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?QXJuYXVkIFZ pc2N1c2k=?= <ho*********@ne wsgroup.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 basicHttpBindin g over HTTPS to connect to WebService. The
configuration is the following
<binding name="SoapBindi ng" closeTimeout="0 0:01:00"
openTimeout="00 :01:00"
receiveTimeout= "00:10:00" sendTimeout="00 :02:00"
allowCookies="f alse"
bypassProxyOnLo cal="false"
hostNameCompari sonMode="Strong Wildcard"
maxBufferSize=" 65536000" maxBufferPoolSi ze="524288"
maxReceivedMess ageSize="655360 00"
messageEncoding ="Text" textEncoding="u tf-8"
transferMode="B uffered" useDefaultWebPr oxy="true" >

<readerQuotas maxDepth="32" maxStringConten tLength="8192"
maxArrayLength= "16384"
maxBytesPerRead ="4096" maxNameTableCha rCount="16384" />
<security mode="Transport ">
<transport clientCredentia lType="None"
proxyCredential Type="None" realm="" />
<message clientCredentia lType="UserName "
algorithmSuite= "Default" />
</security>
</binding>
</basicHttpBindin g>

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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1831
by: Rajiv | last post by:
Hello, I developed a No touch deployment client which accesses data through a web service. The application worked really well until I installed .NET framework 1.1 SP1. It worked well without the Service Pack1. But now it throws a HTTP Protocol violation. Is there any fix to this problem. I understand that MS has strengthened security, but I would like to know if there is a fix to this problem. Please let me know asap. Thanks
26
16526
by: Rajeev Tipnis | last post by:
http://support.microsoft.com/default.aspx?scid=kb;en- us;819450 Questions: 1) Is this patch (fix) applicable to the .NET 1.1 Framework as well? That is, if we have Framework 1.1 (On Win2K3/IIS6.0), do we still need this patch? 2) Does it specifically solve only this error: The underlying connection was closed. An unexpected error
5
24763
by: Vijayakrishna Pondala | last post by:
Hi, We are using the following error randomly, when accessing a webservice method/servlet hosted on JBoss application server: The underlying connection was closed: An unexpected error occurred on a receive. We are using .NET v1.1.
0
1306
by: Matthew B. Lehrman | last post by:
I've googled all over the place trying to get answer to this question and some things have come close, but nothing quite. Asp.NET 1.1, Visual Studio 2003 I am writing Visual Basic apps. I can create a windows form that can consume and use the webservice. I can also access the webservice through my browser. But when I create an Asp.NET Web Application and try to consume the webservice, I am able to add the web reference, but when I call any...
0
1432
by: Apu Nahasapeemapetilon | last post by:
Why do I get the following two error messages, intermittently, when I issue a "SendRequestResponse(methodName, requestEnvelope);" command on a class derived from Microsoft.Web.Services2.Messaging.SoapClient. Intermittent Error Messages: 1) An established connection was aborted by the software in your host machine. 2) The underlying connection was closed: A connection that was expected to be kept alive was closed by the server.
2
2277
by: =?Utf-8?B?RnJpZWRoZWxtRWljaGlu?= | last post by:
I am consuming continously my own web-services on a localhost client with a rate of perhaps 35 request/response-pairs a minute. I am using "invoke-id=1", so there is at the same time only one request pending. After a runtime of 4 days I get the system.net.exception "The underlying connection was closed: An unexpected error occured on a send" Subsequent ws-calls in this state result also in the same exception, browsing a local hosted...
0
2199
by: imonline | last post by:
Hi, I have created a asp.net page which posts XML on the web service using .net 2.0. The page and the webservice was working fine but once I converted them to .net 3.5 I have been getting following exception. And I am having this problem on the local machine that is both of them on same machine. Exception: System.Net.WebException was caught
4
4578
by: Sin Jeong-hun | last post by:
I don't get the message so it's hard to debug that, but some of my clients report that they get "The underlying connection was closed unexpectedly" exception. According to this site (http:// www.dotnetspider.com/resources/2596-e-underlying-connection-was-closed-A-connection.aspx), it's a bug of .NET 2.0, and the author suggests that we use KeepAlive=false until Microsoft fixes it. It seems like almost 5 years have passes since the...
0
9586
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10210
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10043
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8869
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7406
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5298
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3956
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2814
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.