Intermittent Error When Calling Web Service from ASP.NET

Discussion in 'ASP .Net Web Services' started by Steve Piccolo, Dec 9, 2004.

  1. 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!
     
    Steve Piccolo, Dec 9, 2004
    #1
    1. Advertising

  2. Steve Piccolo

    Dan Rogers Guest

    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

    >
    >Subject: Intermittent Error When Calling Web Service from ASP.NET
    >Date: Thu, 9 Dec 2004 08:33:04 -0800
    >Lines: 32
    >Message-ID: <>
    >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!
    >
     
    Dan Rogers, Dec 10, 2004
    #2
    1. Advertising

  3. 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" wrote:

    > 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

    > >
    > >Subject: Intermittent Error When Calling Web Service from ASP.NET
    > >Date: Thu, 9 Dec 2004 08:33:04 -0800
    > >Lines: 32
    > >Message-ID: <>
    > >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!
    > >

    >
    >
     
    Steve Piccolo, Dec 10, 2004
    #3
  4. Steve Piccolo

    Dan Rogers Guest

    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==?="

    <>
    >References: <>

    <>
    >Subject: RE: Intermittent Error When Calling Web Service from ASP.NET
    >Date: Fri, 10 Dec 2004 12:29:03 -0800
    >Lines: 96
    >Message-ID: <>
    >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" wrote:
    >
    >> 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

    >> >
    >> >Subject: Intermittent Error When Calling Web Service from ASP.NET
    >> >Date: Thu, 9 Dec 2004 08:33:04 -0800
    >> >Lines: 32
    >> >Message-ID: <>
    >> >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!
    >> >

    >>
    >>

    >
     
    Dan Rogers, Dec 13, 2004
    #4
  5. Steve Piccolo

    Jeremy M. Guest

    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" wrote:

    > 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==?="

    > <>
    > >References: <>

    > <>
    > >Subject: RE: Intermittent Error When Calling Web Service from ASP.NET
    > >Date: Fri, 10 Dec 2004 12:29:03 -0800
    > >Lines: 96
    > >Message-ID: <>
    > >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" wrote:
    > >
    > >> 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
    > >> >
    > >> >Subject: Intermittent Error When Calling Web Service from ASP.NET
    > >> >Date: Thu, 9 Dec 2004 08:33:04 -0800
    > >> >Lines: 32
    > >> >Message-ID: <>
    > >> >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!
    > >> >
    > >>
    > >>

    > >

    >
    >
     
    Jeremy M., Feb 4, 2005
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Patrick
    Replies:
    2
    Views:
    661
    Steven Cheng[MSFT]
    Oct 1, 2004
  2. C.W.

    intermittent error in asp.net

    C.W., Feb 1, 2008, in forum: ASP .Net
    Replies:
    0
    Views:
    285
  3. sachinkendale
    Replies:
    0
    Views:
    1,391
    sachinkendale
    Aug 19, 2008
  4. Shinz62

    Intermittent Web Service Response Failures

    Shinz62, Jan 13, 2005, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    158
    Shinz62
    Jan 13, 2005
  5. Eddie J

    intermittent error calling .NET web service

    Eddie J, Jan 14, 2005, in forum: ASP .Net Web Services
    Replies:
    4
    Views:
    161
    [MSFT]
    Jan 21, 2005
Loading...

Share This Page