Intermittent Error When Calling Web Service from ASP.NET

S

Steve Piccolo

We’ve been seeing intermittent .NET “underlying connection was closedâ€
exceptions thrown while trying to invoke a Web service from ASP.NET. We are
running .NET 1.1, IIS 6, and Win2003.

This error is occurring where a client invokes a Web service on a front-end
server that in turn invokes a Web service on a middle-tier server. It fails
on the call to the middle-tier server. The error appears to happen when the
client has been sitting idle for approximately 6 minutes and then invokes the
Web service. After the failure, it works fine for subsequent invocations.

We found the following article that addresses this problem:
http://support.microsoft.com/kb/819450. We understand this fix is rolled up
in .NET 1.1 SP1; we've applied that but the errors have continued. The
article also suggests disabling Keep-Alives; however, we can't do that
because Keep-Alives are required for Integration Windows Authentication,
which we are using where the error is occurring.

Here is a typical stack trace for this error:

System.Net.WebException: The underlying connection was closed: An unexpected
error occurred on a receive. at
System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest
request) at
System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebRequest
request) at
System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters) at
Ebusiness.Pem.FileTransfer.ExternalServices.ExternalMiddleTierWS.DownloadNextFile()
at
Ebusiness.Pem.FileTransfer.ExternalServices.ExternalWebService.DownloadNextFile()

Any help would be greatly appreciated!
 
D

Dan Rogers

Have you tried making keep-alives not used from the proxy that the front
end server uses to call the middle tier? The advice about keep-alives
applies to configuring the proxy, not IIS.

Hope this helps

Dan Rogers
Microsoft Corporation
--------------------
Thread-Topic: Intermittent Error When Calling Web Service from ASP.NET
thread-index: AcTeDMGDhvXLnkmGTLO/gktX7kUr4w==
X-WBNR-Posting-Host: 143.182.124.4
From: "=?Utf-8?B?U3RldmUgUGljY29sbw==?=" <Steve (e-mail address removed)>
Subject: Intermittent Error When Calling Web Service from ASP.NET
Date: Thu, 9 Dec 2004 08:33:04 -0800
Lines: 32
Message-ID: <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 8bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.dotnet.framework.aspnet.webservices
NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.1.29
Path: cpmsftngxa10.phx.gbl!TK2MSFTNGXA03.phx.gbl
Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.framework.aspnet.webservices:27116
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices

We’ve been seeing intermittent .NET “underlying connection was closedâ€
exceptions thrown while trying to invoke a Web service from ASP.NET. We are
running .NET 1.1, IIS 6, and Win2003.

This error is occurring where a client invokes a Web service on a front-end
server that in turn invokes a Web service on a middle-tier server. It fails
on the call to the middle-tier server. The error appears to happen when the
client has been sitting idle for approximately 6 minutes and then invokes the
Web service. After the failure, it works fine for subsequent invocations.

We found the following article that addresses this problem:
http://support.microsoft.com/kb/819450. We understand this fix is rolled up
in .NET 1.1 SP1; we've applied that but the errors have continued. The
article also suggests disabling Keep-Alives; however, we can't do that
because Keep-Alives are required for Integration Windows Authentication,
which we are using where the error is occurring.

Here is a typical stack trace for this error:

System.Net.WebException: The underlying connection was closed: An unexpected
error occurred on a receive. at
System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest
request) at
System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebReque st
request) at
System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters) at
Ebusiness.Pem.FileTransfer.ExternalServices.ExternalMiddleTierWS.DownloadNe xtFile()
at
Ebusiness.Pem.FileTransfer.ExternalServices.ExternalWebService.DownloadNext
File()

Any help would be greatly appreciated!
 
S

Steve Piccolo

Hi Dan,

Thanks for getting back with me.

Looking at http://support.microsoft.com/kb/819450, it discusses disabling
Keep-Alives both in IIS and on the proxy. Regardless, if you are using
Integrated Windows Authentication and disable Keep-Alives either in IIS or on
the proxy, it fails with a 401 Unauthorized error (I tested both).

Other ideas?

Regards,
-Steve

Dan Rogers said:
Have you tried making keep-alives not used from the proxy that the front
end server uses to call the middle tier? The advice about keep-alives
applies to configuring the proxy, not IIS.

Hope this helps

Dan Rogers
Microsoft Corporation
--------------------
Thread-Topic: Intermittent Error When Calling Web Service from ASP.NET
thread-index: AcTeDMGDhvXLnkmGTLO/gktX7kUr4w==
X-WBNR-Posting-Host: 143.182.124.4
From: "=?Utf-8?B?U3RldmUgUGljY29sbw==?=" <Steve (e-mail address removed)>
Subject: Intermittent Error When Calling Web Service from ASP.NET
Date: Thu, 9 Dec 2004 08:33:04 -0800
Lines: 32
Message-ID: <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 8bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.dotnet.framework.aspnet.webservices
NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.1.29
Path: cpmsftngxa10.phx.gbl!TK2MSFTNGXA03.phx.gbl
Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.framework.aspnet.webservices:27116
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices

We’ve been seeing intermittent .NET “underlying connection was closedâ€Â
exceptions thrown while trying to invoke a Web service from ASP.NET. We are
running .NET 1.1, IIS 6, and Win2003.

This error is occurring where a client invokes a Web service on a front-end
server that in turn invokes a Web service on a middle-tier server. It fails
on the call to the middle-tier server. The error appears to happen when the
client has been sitting idle for approximately 6 minutes and then invokes the
Web service. After the failure, it works fine for subsequent invocations.

We found the following article that addresses this problem:
http://support.microsoft.com/kb/819450. We understand this fix is rolled up
in .NET 1.1 SP1; we've applied that but the errors have continued. The
article also suggests disabling Keep-Alives; however, we can't do that
because Keep-Alives are required for Integration Windows Authentication,
which we are using where the error is occurring.

Here is a typical stack trace for this error:

System.Net.WebException: The underlying connection was closed: An unexpected
error occurred on a receive. at
System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest
request) at
System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebReque st
request) at
System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters) at
Ebusiness.Pem.FileTransfer.ExternalServices.ExternalMiddleTierWS.DownloadNe xtFile()
at
Ebusiness.Pem.FileTransfer.ExternalServices.ExternalWebService.DownloadNext
File()

Any help would be greatly appreciated!
 
D

Dan Rogers

Hi Steve,

Other than switching over to WS-Security based auth, no. The issue is in
the underlying proxy classes and the way they lose track of connections
that have closed. There is no fix issued yet.

Dan
--------------------
Thread-Topic: Intermittent Error When Calling Web Service from ASP.NET
thread-index: AcTe9uOtFRXyTzurRiODQdOUK2UUjQ==
X-WBNR-Posting-Host: 143.182.124.4
From: "=?Utf-8?B?U3RldmUgUGljY29sbw==?="
Subject: RE: Intermittent Error When Calling Web Service from ASP.NET
Date: Fri, 10 Dec 2004 12:29:03 -0800
Lines: 96
Message-ID: <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 8bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.dotnet.framework.aspnet.webservices
NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.1.29
Path: cpmsftngxa10.phx.gbl!TK2MSFTNGXA03.phx.gbl
Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.framework.aspnet.webservices:27144
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices

Hi Dan,

Thanks for getting back with me.

Looking at http://support.microsoft.com/kb/819450, it discusses disabling
Keep-Alives both in IIS and on the proxy. Regardless, if you are using
Integrated Windows Authentication and disable Keep-Alives either in IIS or on
the proxy, it fails with a 401 Unauthorized error (I tested both).

Other ideas?

Regards,
-Steve

Dan Rogers said:
Have you tried making keep-alives not used from the proxy that the front
end server uses to call the middle tier? The advice about keep-alives
applies to configuring the proxy, not IIS.

Hope this helps

Dan Rogers
Microsoft Corporation
--------------------
Thread-Topic: Intermittent Error When Calling Web Service from ASP.NET
thread-index: AcTeDMGDhvXLnkmGTLO/gktX7kUr4w==
X-WBNR-Posting-Host: 143.182.124.4
From: "=?Utf-8?B?U3RldmUgUGljY29sbw==?=" <Steve (e-mail address removed)>
Subject: Intermittent Error When Calling Web Service from ASP.NET
Date: Thu, 9 Dec 2004 08:33:04 -0800
Lines: 32
Message-ID: <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 8bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.dotnet.framework.aspnet.webservices
NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.1.29
Path: cpmsftngxa10.phx.gbl!TK2MSFTNGXA03.phx.gbl
Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.framework.aspnet.webservices:27116
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices

We’ve been seeing intermittent .NET “underlying connection
was
closedâ€Â
exceptions thrown while trying to invoke a Web service from ASP.NET. We are
running .NET 1.1, IIS 6, and Win2003.

This error is occurring where a client invokes a Web service on a front-end
server that in turn invokes a Web service on a middle-tier server. It fails
on the call to the middle-tier server. The error appears to happen when the
client has been sitting idle for approximately 6 minutes and then
invokes
the
Web service. After the failure, it works fine for subsequent invocations.

We found the following article that addresses this problem:
http://support.microsoft.com/kb/819450. We understand this fix is
rolled
up
in .NET 1.1 SP1; we've applied that but the errors have continued. The
article also suggests disabling Keep-Alives; however, we can't do that
because Keep-Alives are required for Integration Windows Authentication,
which we are using where the error is occurring.

Here is a typical stack trace for this error:

System.Net.WebException: The underlying connection was closed: An unexpected
error occurred on a receive. at
System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest
request) at
System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebReque
st
request) at
System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters) at
Ebusiness.Pem.FileTransfer.ExternalServices.ExternalMiddleTierWS.DownloadNe
Ebusiness.Pem.FileTransfer.ExternalServices.ExternalWebService.DownloadNext
File()

Any help would be greatly appreciated!
 
J

Jeremy M.

We found the problem...

This "underlying connection was closed on a receive" issue occurs because
the client is attempting to use an HTTP connection that the server has
closed. I'm not sure why exactly how the client reuses these connections
(probably from some connection pool) and why it thinks the connection is
established still, but I do know why the server is closing those connections.
It is because they are timing out due to a period of inactivity as the
server sees it. This is fixed by increasing the ConnectionTimeout setting
(default is 120 seconds on w2k3).

Here's an MSDN description of this setting...
ConnectionTimeout: Specifies the amount of time, in seconds, that the server
will wait before disconnecting an inactive connection.

Here are instructions on how to modify this setting...
1) In IIS Manager, expand the local computer, expand the Web Sites or FTP
Sites folder, right-click a Web or FTP site, and click Properties.
2) On the Web Site or FTP Site tab, in the Connection timeout box, type the
maximum number of seconds that IIS should maintain an idle connection before
resetting the connection.
3) For the WWW service, verify that the Enable HTTP Keep-Alives box is
selected. For more information, see Enabling HTTP Keep-Alives.
4) Click Apply, and then click OK.


Dan Rogers said:
Hi Steve,

Other than switching over to WS-Security based auth, no. The issue is in
the underlying proxy classes and the way they lose track of connections
that have closed. There is no fix issued yet.

Dan
--------------------
Thread-Topic: Intermittent Error When Calling Web Service from ASP.NET
thread-index: AcTe9uOtFRXyTzurRiODQdOUK2UUjQ==
X-WBNR-Posting-Host: 143.182.124.4
From: "=?Utf-8?B?U3RldmUgUGljY29sbw==?="
Subject: RE: Intermittent Error When Calling Web Service from ASP.NET
Date: Fri, 10 Dec 2004 12:29:03 -0800
Lines: 96
Message-ID: <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 8bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.dotnet.framework.aspnet.webservices
NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.1.29
Path: cpmsftngxa10.phx.gbl!TK2MSFTNGXA03.phx.gbl
Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.framework.aspnet.webservices:27144
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices

Hi Dan,

Thanks for getting back with me.

Looking at http://support.microsoft.com/kb/819450, it discusses disabling
Keep-Alives both in IIS and on the proxy. Regardless, if you are using
Integrated Windows Authentication and disable Keep-Alives either in IIS or on
the proxy, it fails with a 401 Unauthorized error (I tested both).

Other ideas?

Regards,
-Steve

Dan Rogers said:
Have you tried making keep-alives not used from the proxy that the front
end server uses to call the middle tier? The advice about keep-alives
applies to configuring the proxy, not IIS.

Hope this helps

Dan Rogers
Microsoft Corporation
--------------------
Thread-Topic: Intermittent Error When Calling Web Service from ASP.NET
thread-index: AcTeDMGDhvXLnkmGTLO/gktX7kUr4w==
X-WBNR-Posting-Host: 143.182.124.4
From: "=?Utf-8?B?U3RldmUgUGljY29sbw==?=" <Steve
(e-mail address removed)>
Subject: Intermittent Error When Calling Web Service from ASP.NET
Date: Thu, 9 Dec 2004 08:33:04 -0800
Lines: 32
Message-ID: <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 8bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.dotnet.framework.aspnet.webservices
NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.1.29
Path: cpmsftngxa10.phx.gbl!TK2MSFTNGXA03.phx.gbl
Xref: cpmsftngxa10.phx.gbl
microsoft.public.dotnet.framework.aspnet.webservices:27116
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices

We’ve been seeing intermittent .NET “underlying connection was
closedâ€ÂÂ
exceptions thrown while trying to invoke a Web service from ASP.NET. We
are
running .NET 1.1, IIS 6, and Win2003.

This error is occurring where a client invokes a Web service on a
front-end
server that in turn invokes a Web service on a middle-tier server. It
fails
on the call to the middle-tier server. The error appears to happen when
the
client has been sitting idle for approximately 6 minutes and then invokes
the
Web service. After the failure, it works fine for subsequent invocations.

We found the following article that addresses this problem:
http://support.microsoft.com/kb/819450. We understand this fix is rolled
up
in .NET 1.1 SP1; we've applied that but the errors have continued. The
article also suggests disabling Keep-Alives; however, we can't do that
because Keep-Alives are required for Integration Windows Authentication,
which we are using where the error is occurring.

Here is a typical stack trace for this error:

System.Net.WebException: The underlying connection was closed: An
unexpected
error occurred on a receive. at
System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest
request) at
System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebReque
st
request) at
System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters) at
Ebusiness.Pem.FileTransfer.ExternalServices.ExternalMiddleTierWS.DownloadNe
xtFile()
at
Ebusiness.Pem.FileTransfer.ExternalServices.ExternalWebService.DownloadNext
File()

Any help would be greatly appreciated!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top