The underlying connection was closed: An unexpected error occurred on a receive

Discussion in 'ASP .Net Web Services' started by Joel Zhou, Sep 27, 2004.

  1. Joel Zhou

    Joel Zhou Guest

    We are running IIS 6 on Win2003, with .Net 1.1. I have a client that
    talks to my Web Service. The Web Service call is pretty lengthy (can
    take more than a few minutes to complete).

    I noticed when the web service call takes more than ~180 seconds to
    complete, the client will get the above exception. I tried calling
    both synchronously and asynchronously call and they both failed with
    the same error.

    If I increase the "Connection timeout" in the IIS Manager for the web
    site, I can increase the time before the client will get the
    exception. However, I don't expect the IIS to timeout my client
    connection since the client is waiting for the server to complete the
    call. I set the client side timeout to a huge number (int.MaxValue). I
    tried WinXP with .Net 1.1 and I didn't have this error.

    I tried Q819450 but it didn't help. I cannot turn off Keep-alives
    because I use Integrated Windows Authentication.

    Anyone know what might be the problem here?

    Thanks,
    Joel
    Joel Zhou, Sep 27, 2004
    #1
    1. Advertising

  2. Joel Zhou

    Guest Guest


    > We are running IIS 6 on Win2003, with .Net 1.1. I have a client that
    > talks to my Web Service. The Web Service call is pretty lengthy (can
    > take more than a few minutes to complete).
    >
    > I noticed when the web service call takes more than ~180 seconds to
    > complete, the client will get the above exception. I tried calling
    > both synchronously and asynchronously call and they both failed with
    > the same error.
    >
    > If I increase the "Connection timeout" in the IIS Manager for the web
    > site, I can increase the time before the client will get the
    > exception. However, I don't expect the IIS to timeout my client
    > connection since the client is waiting for the server to complete the
    > call. I set the client side timeout to a huge number (int.MaxValue). I
    > tried WinXP with .Net 1.1 and I didn't have this error.
    >
    > I tried Q819450 but it didn't help. I cannot turn off Keep-alives
    > because I use Integrated Windows Authentication.
    >
    > Anyone know what might be the problem here?
    >
    > Thanks,
    > Joel


    Hello,

    You are describing exactly the same problem we have.
    Our webservice takes also long time to finish. If we are running on WinXP with IIS 5.1, there is no problem, but on Windows2003 with IIS 6.0, the client gets an exception.
    I tested with the 'turn-off keep-alives', but the problem was not resolved.

    Did you find any solution?
    Regards,
    Eri

    User submitted from AEWNET (http://www.aewnet.com/)
    Guest, Nov 3, 2004
    #2
    1. Advertising

  3. Joel Zhou

    RK Guest

    We had this problem earlier, but the fix in microsoft kb819450 worked
    for us.
    In our case C# class library is making call to web service.. so we
    created wrapper class and added the following code in it..

    class classWebServiceWrapper:myWebService
    {
    protected override WebRequest GetWebRequest(Uri uri)
    {
    HttpWebRequest webRequest =
    (HttpWebRequest)base.GetWebRequest(uri);
    webRequest.KeepAlive = false;
    return webRequest;
    }
    }

    so inside the class library instead calling web service directly, call
    wrapper class as follows

    myWebService ws = new classWebServiceWrapper();

    ps:
    protected override WebRequest GetWebRequest(Uri uri)
    {
    HttpWebRequest webRequest =
    (HttpWebRequest)base.GetWebRequest(uri);
    webRequest.KeepAlive = false;
    return webRequest;
    }
    Adding this code in reference.cs file is also worked for us. but
    everytime adding this part of the code is little extra work, so we
    were using wrapper class.


    goodluck.
    --RK






    Guest <Guest@aew_nospam.com> wrote in message news:<>...
    > > We are running IIS 6 on Win2003, with .Net 1.1. I have a client that
    > > talks to my Web Service. The Web Service call is pretty lengthy (can
    > > take more than a few minutes to complete).
    > >
    > > I noticed when the web service call takes more than ~180 seconds to
    > > complete, the client will get the above exception. I tried calling
    > > both synchronously and asynchronously call and they both failed with
    > > the same error.
    > >
    > > If I increase the "Connection timeout" in the IIS Manager for the web
    > > site, I can increase the time before the client will get the
    > > exception. However, I don't expect the IIS to timeout my client
    > > connection since the client is waiting for the server to complete the
    > > call. I set the client side timeout to a huge number (int.MaxValue). I
    > > tried WinXP with .Net 1.1 and I didn't have this error.
    > >
    > > I tried Q819450 but it didn't help. I cannot turn off Keep-alives
    > > because I use Integrated Windows Authentication.
    > >
    > > Anyone know what might be the problem here?
    > >
    > > Thanks,
    > > Joel

    >
    > Hello,
    >
    > You are describing exactly the same problem we have.
    > Our webservice takes also long time to finish. If we are running on WinXP with IIS 5.1, there is no problem, but on Windows2003 with IIS 6.0, the client gets an exception.
    > I tested with the 'turn-off keep-alives', but the problem was not resolved.
    >
    > Did you find any solution?
    > Regards,
    > Eric
    >
    > User submitted from AEWNET (http://www.aewnet.com/)
    RK, Nov 3, 2004
    #3
  4. Joel Zhou

    subha Guest

    Did you find any solution to this? I have a similar error - mine says
    unexpected error occured on a send. I have windows 2000 and IIS 5.0 -
    I have the HTTP- keep alives turned off. Did not help. I tried adding
    the code block for keepalives false. That did not help either.
    subha, Nov 16, 2004
    #4
  5. Joel Zhou

    RK Guest

    what is the version of .NET Framework are you using?

    http://support.microsoft.com/default.aspx?scid=kb;EN-US;819450
    resolved my problem.

    Leave Http-keep alives property CHECKED-ON on the server. Try adding
    the following code in reference.cs file and then compile your client
    application.

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

    webRequest.KeepAlive = false;

    return webRequest;
    }

    --RK




    (subha) wrote in message news:<>...
    > Did you find any solution to this? I have a similar error - mine says
    > unexpected error occured on a send. I have windows 2000 and IIS 5.0 -
    > I have the HTTP- keep alives turned off. Did not help. I tried adding
    > the code block for keepalives false. That did not help either.
    RK, Nov 16, 2004
    #5
  6. Joel Zhou

    subha Guest

    Re: The underlying connection was closed: An unexpected error occu

    I have both .NET 1.0 and 1.1 installed. My aspnet_isapi.dll is 1.1.4322.2035
    I believe.
    I have tried KB article and HTTP keep alive. I am connecting to the service
    on my local machine.


    "RK" wrote:

    > what is the version of .NET Framework are you using?
    >
    > http://support.microsoft.com/default.aspx?scid=kb;EN-US;819450
    > resolved my problem.
    >
    > Leave Http-keep alives property CHECKED-ON on the server. Try adding
    > the following code in reference.cs file and then compile your client
    > application.
    >
    > protected override WebRequest GetWebRequest(Uri uri)
    > {
    > HttpWebRequest webRequest = (HttpWebRequest) base.GetWebRequest(uri);
    >
    > webRequest.KeepAlive = false;
    >
    > return webRequest;
    > }
    >
    > --RK
    >
    >
    >
    >
    > (subha) wrote in message news:<>...
    > > Did you find any solution to this? I have a similar error - mine says
    > > unexpected error occured on a send. I have windows 2000 and IIS 5.0 -
    > > I have the HTTP- keep alives turned off. Did not help. I tried adding
    > > the code block for keepalives false. That did not help either.

    >
    subha, Nov 16, 2004
    #6
  7. Joel Zhou

    Dan Rogers Guest

    Hi,

    I'm sure that I must be misunderstanding your question - which as I read
    down thru the thread tells me that you know your web service logic is
    taking a very long time, and that unless you turn up the server side
    timeout threshold, the server timeout logic does what it is designed to do
    - close the connection and kill the thread. The result in the client is a
    timeout exception gets raised, and the caller is informed that the request
    did not complete.

    From what I can tell, this is what is supposed to be happening, and the
    fact that you can set the timeout to a large enough value to accommodate
    your call seems to also indicate that the server is working as designed.

    To get an idea as to why this could possibly be "correct behavior" -
    consider the role that the web server plays. It has a limited number of
    threads that it has to share all work across. Each request is allocated to
    a thread, and as long as a request is being serviced, the pool of available
    threads is reduced by the number of active requests. In the case of long
    response times due to making the server do a whole lot of work, the web
    server by default will see this as a resource problem, conclude that the
    thread has gone bonkers, and so it kills it.

    To prevent the server from doing this, you get to choose how long too long
    is on a per service basis.

    Now for some unasked for advice: Don't make your services do these kind of
    long long requests. The propensity for requesters to conclude the same
    thing the server has concluded is normal - so what ends up happening is
    people hit the refresh, or programs retry in these long long operation
    scenarios. If the server didn't kill off wayward threads, this retry
    behavior would quickly exhaust the capacity of resources on the server, and
    the callers still don't have their answer.

    If you need to make batch-like operations happen, make them happen by
    letting the web service call kick off the work, and then immediately
    return, not awaiting the end of the operation. If you need to let the
    callers know when their particular "batch" has completed, you can have them
    provide a parameter with a unique ID in it that specifies the batch number.
    When you kick off the long running operation (perhaps using a job
    scheduler), you can log the batch and relate it to the caller assigned ID.
    Alternately you could return the batch ID to the caller.

    Later, the caller can periodically poll to see if a particular batch is
    done. In this way, the connection to the web server isn't kept open, the
    thread on the server isn't kept busy for undue periods, and the caller
    isn't hung waiting for your slow server side operation to complete.

    I hope this helps,

    Dan Rogers
    Microsoft Corporation
    --------------------
    >From: (Joel Zhou)
    >Newsgroups: microsoft.public.dotnet.framework.aspnet.webservices
    >Subject: The underlying connection was closed: An unexpected error

    occurred on a receive
    >Date: 27 Sep 2004 14:29:29 -0700
    >Organization: http://groups.google.com
    >Lines: 23
    >Message-ID: <>
    >NNTP-Posting-Host: 208.251.33.202
    >Content-Type: text/plain; charset=ISO-8859-1
    >Content-Transfer-Encoding: 8bit
    >X-Trace: posting.google.com 1096320570 1219 127.0.0.1 (27 Sep 2004

    21:29:30 GMT)
    >X-Complaints-To:
    >NNTP-Posting-Date: Mon, 27 Sep 2004 21:29:30 +0000 (UTC)
    >Path:

    cpmsftngxa06.phx.gbl!TK2MSFTNGXA03.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.s
    ul.t-online.de!t-online.de!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!p
    ostnews1.google.com!not-for-mail
    >Xref: cpmsftngxa06.phx.gbl

    microsoft.public.dotnet.framework.aspnet.webservices:25660
    >X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices
    >
    >We are running IIS 6 on Win2003, with .Net 1.1. I have a client that
    >talks to my Web Service. The Web Service call is pretty lengthy (can
    >take more than a few minutes to complete).
    >
    >I noticed when the web service call takes more than ~180 seconds to
    >complete, the client will get the above exception. I tried calling
    >both synchronously and asynchronously call and they both failed with
    >the same error.
    >
    >If I increase the "Connection timeout" in the IIS Manager for the web
    >site, I can increase the time before the client will get the
    >exception. However, I don't expect the IIS to timeout my client
    >connection since the client is waiting for the server to complete the
    >call. I set the client side timeout to a huge number (int.MaxValue). I
    >tried WinXP with .Net 1.1 and I didn't have this error.
    >
    >I tried Q819450 but it didn't help. I cannot turn off Keep-alives
    >because I use Integrated Windows Authentication.
    >
    >Anyone know what might be the problem here?
    >
    >Thanks,
    >Joel
    >
    Dan Rogers, Nov 17, 2004
    #7
  8. Joel Zhou

    subha Guest

    RE: The underlying connection was closed: An unexpected error occu

    Dan,
    Joel's webservice call took a long time. Mine is a very small call. I just
    print HelloWorld. On the IE browser, the method gets invoked and shows me the
    result in a few seconds. But, my C# app throws this error about Underlying
    connection.

    "Dan Rogers" wrote:

    > Hi,
    >
    > I'm sure that I must be misunderstanding your question - which as I read
    > down thru the thread tells me that you know your web service logic is
    > taking a very long time, and that unless you turn up the server side
    > timeout threshold, the server timeout logic does what it is designed to do
    > - close the connection and kill the thread. The result in the client is a
    > timeout exception gets raised, and the caller is informed that the request
    > did not complete.
    >
    > From what I can tell, this is what is supposed to be happening, and the
    > fact that you can set the timeout to a large enough value to accommodate
    > your call seems to also indicate that the server is working as designed.
    >
    > To get an idea as to why this could possibly be "correct behavior" -
    > consider the role that the web server plays. It has a limited number of
    > threads that it has to share all work across. Each request is allocated to
    > a thread, and as long as a request is being serviced, the pool of available
    > threads is reduced by the number of active requests. In the case of long
    > response times due to making the server do a whole lot of work, the web
    > server by default will see this as a resource problem, conclude that the
    > thread has gone bonkers, and so it kills it.
    >
    > To prevent the server from doing this, you get to choose how long too long
    > is on a per service basis.
    >
    > Now for some unasked for advice: Don't make your services do these kind of
    > long long requests. The propensity for requesters to conclude the same
    > thing the server has concluded is normal - so what ends up happening is
    > people hit the refresh, or programs retry in these long long operation
    > scenarios. If the server didn't kill off wayward threads, this retry
    > behavior would quickly exhaust the capacity of resources on the server, and
    > the callers still don't have their answer.
    >
    > If you need to make batch-like operations happen, make them happen by
    > letting the web service call kick off the work, and then immediately
    > return, not awaiting the end of the operation. If you need to let the
    > callers know when their particular "batch" has completed, you can have them
    > provide a parameter with a unique ID in it that specifies the batch number.
    > When you kick off the long running operation (perhaps using a job
    > scheduler), you can log the batch and relate it to the caller assigned ID.
    > Alternately you could return the batch ID to the caller.
    >
    > Later, the caller can periodically poll to see if a particular batch is
    > done. In this way, the connection to the web server isn't kept open, the
    > thread on the server isn't kept busy for undue periods, and the caller
    > isn't hung waiting for your slow server side operation to complete.
    >
    > I hope this helps,
    >
    > Dan Rogers
    > Microsoft Corporation
    > --------------------
    > >From: (Joel Zhou)
    > >Newsgroups: microsoft.public.dotnet.framework.aspnet.webservices
    > >Subject: The underlying connection was closed: An unexpected error

    > occurred on a receive
    > >Date: 27 Sep 2004 14:29:29 -0700
    > >Organization: http://groups.google.com
    > >Lines: 23
    > >Message-ID: <>
    > >NNTP-Posting-Host: 208.251.33.202
    > >Content-Type: text/plain; charset=ISO-8859-1
    > >Content-Transfer-Encoding: 8bit
    > >X-Trace: posting.google.com 1096320570 1219 127.0.0.1 (27 Sep 2004

    > 21:29:30 GMT)
    > >X-Complaints-To:
    > >NNTP-Posting-Date: Mon, 27 Sep 2004 21:29:30 +0000 (UTC)
    > >Path:

    > cpmsftngxa06.phx.gbl!TK2MSFTNGXA03.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.s
    > ul.t-online.de!t-online.de!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!p
    > ostnews1.google.com!not-for-mail
    > >Xref: cpmsftngxa06.phx.gbl

    > microsoft.public.dotnet.framework.aspnet.webservices:25660
    > >X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices
    > >
    > >We are running IIS 6 on Win2003, with .Net 1.1. I have a client that
    > >talks to my Web Service. The Web Service call is pretty lengthy (can
    > >take more than a few minutes to complete).
    > >
    > >I noticed when the web service call takes more than ~180 seconds to
    > >complete, the client will get the above exception. I tried calling
    > >both synchronously and asynchronously call and they both failed with
    > >the same error.
    > >
    > >If I increase the "Connection timeout" in the IIS Manager for the web
    > >site, I can increase the time before the client will get the
    > >exception. However, I don't expect the IIS to timeout my client
    > >connection since the client is waiting for the server to complete the
    > >call. I set the client side timeout to a huge number (int.MaxValue). I
    > >tried WinXP with .Net 1.1 and I didn't have this error.
    > >
    > >I tried Q819450 but it didn't help. I cannot turn off Keep-alives
    > >because I use Integrated Windows Authentication.
    > >
    > >Anyone know what might be the problem here?
    > >
    > >Thanks,
    > >Joel
    > >

    >
    >
    subha, Nov 17, 2004
    #8
  9. Joel Zhou

    Dan Rogers Guest

    RE: The underlying connection was closed: An unexpected error occu

    Have you tried checking the ASP.net configuration for this vroot?

    I see this sometimes - cant' say that it's doing the right thing. But I've
    had success in going to the vroot in IIS manager, and if the Application
    field is blank (but not greyed out), try clicking the "remove" button,
    followed by the "create" button. This re-sets the application settings -
    which may have become corrupt.

    Hope that helps

    Dan Rogers
    Microsoft Corporation
    --------------------
    >Thread-Topic: The underlying connection was closed: An unexpected error

    occu
    >thread-index: AcTMzZW31diFtubTRhKRN1Il7RdrQA==
    >X-WBNR-Posting-Host: 163.188.94.176
    >From: "=?Utf-8?B?c3ViaGE=?=" <>
    >References: <>

    <>
    >Subject: RE: The underlying connection was closed: An unexpected error occu
    >Date: Wed, 17 Nov 2004 09:48:02 -0800
    >Lines: 110
    >Message-ID: <>
    >MIME-Version: 1.0
    >Content-Type: text/plain;
    > charset="Utf-8"
    >Content-Transfer-Encoding: 7bit
    >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:26672
    >X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices
    >
    >Dan,
    >Joel's webservice call took a long time. Mine is a very small call. I just
    >print HelloWorld. On the IE browser, the method gets invoked and shows me

    the
    >result in a few seconds. But, my C# app throws this error about Underlying
    >connection.
    >
    >"Dan Rogers" wrote:
    >
    >> Hi,
    >>
    >> I'm sure that I must be misunderstanding your question - which as I read
    >> down thru the thread tells me that you know your web service logic is
    >> taking a very long time, and that unless you turn up the server side
    >> timeout threshold, the server timeout logic does what it is designed to

    do
    >> - close the connection and kill the thread. The result in the client is

    a
    >> timeout exception gets raised, and the caller is informed that the

    request
    >> did not complete.
    >>
    >> From what I can tell, this is what is supposed to be happening, and the
    >> fact that you can set the timeout to a large enough value to accommodate
    >> your call seems to also indicate that the server is working as designed.
    >>
    >> To get an idea as to why this could possibly be "correct behavior" -
    >> consider the role that the web server plays. It has a limited number of
    >> threads that it has to share all work across. Each request is allocated

    to
    >> a thread, and as long as a request is being serviced, the pool of

    available
    >> threads is reduced by the number of active requests. In the case of

    long
    >> response times due to making the server do a whole lot of work, the web
    >> server by default will see this as a resource problem, conclude that the
    >> thread has gone bonkers, and so it kills it.
    >>
    >> To prevent the server from doing this, you get to choose how long too

    long
    >> is on a per service basis.
    >>
    >> Now for some unasked for advice: Don't make your services do these kind

    of
    >> long long requests. The propensity for requesters to conclude the same
    >> thing the server has concluded is normal - so what ends up happening is
    >> people hit the refresh, or programs retry in these long long operation
    >> scenarios. If the server didn't kill off wayward threads, this retry
    >> behavior would quickly exhaust the capacity of resources on the server,

    and
    >> the callers still don't have their answer.
    >>
    >> If you need to make batch-like operations happen, make them happen by
    >> letting the web service call kick off the work, and then immediately
    >> return, not awaiting the end of the operation. If you need to let the
    >> callers know when their particular "batch" has completed, you can have

    them
    >> provide a parameter with a unique ID in it that specifies the batch

    number.
    >> When you kick off the long running operation (perhaps using a job
    >> scheduler), you can log the batch and relate it to the caller assigned

    ID.
    >> Alternately you could return the batch ID to the caller.
    >>
    >> Later, the caller can periodically poll to see if a particular batch is
    >> done. In this way, the connection to the web server isn't kept open,

    the
    >> thread on the server isn't kept busy for undue periods, and the caller
    >> isn't hung waiting for your slow server side operation to complete.
    >>
    >> I hope this helps,
    >>
    >> Dan Rogers
    >> Microsoft Corporation
    >> --------------------
    >> >From: (Joel Zhou)
    >> >Newsgroups: microsoft.public.dotnet.framework.aspnet.webservices
    >> >Subject: The underlying connection was closed: An unexpected error

    >> occurred on a receive
    >> >Date: 27 Sep 2004 14:29:29 -0700
    >> >Organization: http://groups.google.com
    >> >Lines: 23
    >> >Message-ID: <>
    >> >NNTP-Posting-Host: 208.251.33.202
    >> >Content-Type: text/plain; charset=ISO-8859-1
    >> >Content-Transfer-Encoding: 8bit
    >> >X-Trace: posting.google.com 1096320570 1219 127.0.0.1 (27 Sep 2004

    >> 21:29:30 GMT)
    >> >X-Complaints-To:
    >> >NNTP-Posting-Date: Mon, 27 Sep 2004 21:29:30 +0000 (UTC)
    >> >Path:

    >>

    cpmsftngxa06.phx.gbl!TK2MSFTNGXA03.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.s
    >>

    ul.t-online.de!t-online.de!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!p
    >> ostnews1.google.com!not-for-mail
    >> >Xref: cpmsftngxa06.phx.gbl

    >> microsoft.public.dotnet.framework.aspnet.webservices:25660
    >> >X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices
    >> >
    >> >We are running IIS 6 on Win2003, with .Net 1.1. I have a client that
    >> >talks to my Web Service. The Web Service call is pretty lengthy (can
    >> >take more than a few minutes to complete).
    >> >
    >> >I noticed when the web service call takes more than ~180 seconds to
    >> >complete, the client will get the above exception. I tried calling
    >> >both synchronously and asynchronously call and they both failed with
    >> >the same error.
    >> >
    >> >If I increase the "Connection timeout" in the IIS Manager for the web
    >> >site, I can increase the time before the client will get the
    >> >exception. However, I don't expect the IIS to timeout my client
    >> >connection since the client is waiting for the server to complete the
    >> >call. I set the client side timeout to a huge number (int.MaxValue). I
    >> >tried WinXP with .Net 1.1 and I didn't have this error.
    >> >
    >> >I tried Q819450 but it didn't help. I cannot turn off Keep-alives
    >> >because I use Integrated Windows Authentication.
    >> >
    >> >Anyone know what might be the problem here?
    >> >
    >> >Thanks,
    >> >Joel
    >> >

    >>
    >>

    >
    Dan Rogers, Nov 18, 2004
    #9
  10. Joel Zhou

    Sefai Guest

    Re: The underlying connection was closed: An unexpected error occu

    > >> If you need to make batch-like operations happen, make them happen by
    > >> letting the web service call kick off the work, and then immediately
    > >> return, not awaiting the end of the operation. If you need to let the
    > >> callers know when their particular "batch" has completed, you can have

    > them
    > >> provide a parameter with a unique ID in it that specifies the batch

    > number.
    > >> When you kick off the long running operation (perhaps using a job
    > >> scheduler), you can log the batch and relate it to the caller assigned

    > ID.
    > >> Alternately you could return the batch ID to the caller.
    > >>
    > >> Later, the caller can periodically poll to see if a particular batch is
    > >> done. In this way, the connection to the web server isn't kept open,

    > the
    > >> thread on the server isn't kept busy for undue periods, and the caller
    > >> isn't hung waiting for your slow server side operation to complete.
    > >>
    > >> I hope this helps,
    > >>
    > >> Dan Rogers
    > >> Microsoft Corporation


    Can you give an example for "kick off operation". I mean how to
    continue operation after you return the WebMethod.

    Thanks.
    Sefai, Nov 26, 2004
    #10
  11. Joel Zhou

    Dan Rogers Guest

    Re: The underlying connection was closed: An unexpected error occu

    You could make your web method start a scheduled job (e.g. batch), or place
    the message in a queue and have a service or a COM+ component do the work.

    There are even ways to do an asynch server side execution. One of them is
    to make the method a one-way method. The other is to add in Begin/End
    method shells on the server side. See the article at
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnservice/h
    tml/service10012002.asp.

    Hope this helps

    Dan Rogers
    --------------------
    >From: (Sefai)
    >Newsgroups: microsoft.public.dotnet.framework.aspnet.webservices
    >Subject: Re: The underlying connection was closed: An unexpected error occu
    >Date: 26 Nov 2004 01:28:27 -0800
    >Organization: http://groups.google.com
    >Lines: 27
    >Message-ID: <>
    >References: <>

    <>
    <>
    <>
    >NNTP-Posting-Host: 193.140.23.16
    >Content-Type: text/plain; charset=ISO-8859-1
    >Content-Transfer-Encoding: 8bit
    >X-Trace: posting.google.com 1101461307 4699 127.0.0.1 (26 Nov 2004

    09:28:27 GMT)
    >X-Complaints-To:
    >NNTP-Posting-Date: Fri, 26 Nov 2004 09:28:27 +0000 (UTC)
    >Path:

    cpmsftngxa10.phx.gbl!TK2MSFTNGXA03.phx.gbl!TK2MSFTNGP08.phx.gbl!news-out.cwi
    x.com!newsfeed.cwix.com!prodigy.com!news.glorb.com!postnews.google.com!not-f
    or-mail
    >Xref: cpmsftngxa10.phx.gbl

    microsoft.public.dotnet.framework.aspnet.webservices:26822
    >X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices
    >
    >> >> If you need to make batch-like operations happen, make them happen by
    >> >> letting the web service call kick off the work, and then immediately
    >> >> return, not awaiting the end of the operation. If you need to let

    the
    >> >> callers know when their particular "batch" has completed, you can

    have
    >> them
    >> >> provide a parameter with a unique ID in it that specifies the batch

    >> number.
    >> >> When you kick off the long running operation (perhaps using a job
    >> >> scheduler), you can log the batch and relate it to the caller

    assigned
    >> ID.
    >> >> Alternately you could return the batch ID to the caller.
    >> >>
    >> >> Later, the caller can periodically poll to see if a particular batch

    is
    >> >> done. In this way, the connection to the web server isn't kept open,

    >> the
    >> >> thread on the server isn't kept busy for undue periods, and the

    caller
    >> >> isn't hung waiting for your slow server side operation to complete.
    >> >>
    >> >> I hope this helps,
    >> >>
    >> >> Dan Rogers
    >> >> Microsoft Corporation

    >
    >Can you give an example for "kick off operation". I mean how to
    >continue operation after you return the WebMethod.
    >
    >Thanks.
    >
    Dan Rogers, Nov 29, 2004
    #11
    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. TCook
    Replies:
    0
    Views:
    6,402
    TCook
    Mar 4, 2006
  2. imonline
    Replies:
    0
    Views:
    925
    imonline
    Jan 22, 2008
  3. OpHi
    Replies:
    1
    Views:
    541
    Joseph Crum
    Nov 12, 2003
  4. Replies:
    0
    Views:
    155
  5. hs
    Replies:
    0
    Views:
    150
Loading...

Share This Page