none
ASP.NET on IIS timing out on (disconnecting) connection RRS feed

  • Question

  • I have a simple ASP.net page that you click a button, it does some long calculation, then returns a result. Long as in 1 hour.

    I have setup my browser to not time out, but my IIS is disconnecting the connection after 15 minutes (I see that in wireshark).

    I have changed my

    * application pool's limit and idle timeout to 1 day

    * website's limit (connection timeout) to 65535

    * web.config sessionState timeout to 1440

    * made my browser periodically send some bytes

    None of these help, my connection still disconnects at 15 minutes.

    Can someone help me out/point me to what I can do to keep the connection up?? Because I am using asp.net, I am not sure how to make server send back heartbeats...

    protectedvoidButton_clicked(objectsender, EventArgse) {

       var result = longcalculation(); // takes an hour

       ResultBox.Text = Server.HtmlEncode(result);

    }

    Friday, August 25, 2017 6:11 PM

All replies

  • I have a simple ASP.net page that you click a button, it does some long calculation, then returns a result. Long as in 1 hour.

    You are joking, right? Someone gave you a requirement to run a calculation in an ASP.NET Web application that runs a calculation for an hour or more with possibly tying up Web server resources bringing the Web server to its knees so that it couldn't run other user requests.

    Friday, August 25, 2017 10:41 PM
  • This is just a private setup with 4-5 users who don't need the service all at the same time. We did asp.net/IIS only because the package that does the calculation can only be called from windows code. So these long calculations is not really a problem.


    That said, anybody has any idea how I can keep the connections up?


    Saturday, August 26, 2017 12:36 AM
  • Hello fadeawayinthedark,

    I recommend refactoring so you launch the long running task and then have the client poll to until the task is complete.

    If you are not able to and you really want to keep a session open for this long...  My guess is there is something in between that is breaking the connection like a firewall or router.  

    If this is all on the same machine... Check the application or system logs to see if there are any clues there.  


    Cheers, Jeff

    Saturday, August 26, 2017 12:42 AM
  • Thanks, I did want to break it up, but the 3rd party package that does the actual calculation is out of my control (as you may have guessed... this is just a web based front for launching that).

    I did a wireshark capture on the machine that hosts the IIS, and I see the RST coming from this host, unprovoked... so it does look to be coming from this host itself. I would have thought IIS itself is the only who closed the connection and I thought those options I fiddled with were it...

    Saturday, August 26, 2017 1:00 AM
  • You adjusted IIS and asp.net and you put in a keep alive.  Looks like you covered it well.

    if you run the client on the same machine do you get the same results?  I am really fishing as the connection should stay alive based on what you have done.

    I would still consider running the 3rd party package as a separate process.  It is more moving parts but in the end it is much more scalable.  I would even consider putting a queue in between (re., MSMQ would be great for this) or even a database.

    Again it depends on your exact requirements but you appear to be doing it correct as far as keeping the session alive.  To me though, IIS was not designed for long running requests hence my encouragement to rethink the design.

    Sorry, I could not be more help!


    Cheers, Jeff

    Saturday, August 26, 2017 1:45 AM
  • This is just a private setup with 4-5 users who don't need the service all at the same time. We did asp.net/IIS only because the package that does the calculation can only be called from windows code. So these long calculations is not really a problem.


    That said, anybody has any idea how I can keep the connections up?


    https://www.codeproject.com/Tips/896768/Long-Running-Process-Status-Check-with-SignalR-in

    Saturday, August 26, 2017 1:50 AM
  • Thanks a lot! I think reorganizing it is probably the way to go.
    Saturday, August 26, 2017 6:05 PM
  • Hi fad,

    Has your issue been resolved? If it has, it would be appreciated if you could share us your solution.

    If not, could you make below tests?

    1. Based on your description, longcalculation is coming from third party. I suggest you create a console application to call longcalculation, will you receive any error?

    2. Replace longcalculation by “System.Threading.Thread.Sleep(TimeSpan.FromMinutes(60));”, will you receive the same error?

    Best Regards,

    Edward


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, August 28, 2017 1:57 AM