ASP. Net on Azure times out RRS feed

  • Question

  • User-1209441616 posted
    Hi guys,
    I've got an Asp. Net all that uses sockets to listen for TCP/IP data over a port which I set to port 13000. The app runs continuously when a button is pressed on the ASP page. The ASP app i created establishes a connection to a proprietary app which exports data over TCP-IP. I've basically created my own reader that takes in the data in ASP. When i run the program in local host in debug the application connects without issue and stays connected for hours or until i stop debugging. I've recently moved the app over to an Azure Windows server 2016 VM and it works over the Internet. However, it seems that the ASP app and the proprietary software exporting TCP-IP data only stays connected for a few minutes, maybe 5 or 10. I was thinking it must be something in my webconfig file, which is why I'm posting here.
    I've tried a couple of things in the web config file but I'm unsure if it's properly implemented. Ive set the execution timeout to 36000 seconds and sessionState to 720 minutes but it doesn't have an effect it seems. When i press the start button i want the process to keep running until i close the browser or it times out. This is because data may be sent at any time over the period of hours. It seems to work fine on the localhost but just seems to time out over the web. Any help is appreciated!
    Thanks guys
    Thursday, May 17, 2018 10:53 PM

All replies

  • User283571144 posted

    Hi cfcorp,

    According to your description, we couldn't directly find the reason.

    Could you please post the details error message from event view or something else?

    Best Regards,


    Friday, May 18, 2018 8:40 AM
  • User-1209441616 posted

    Hi Brandon ZWZ,

    thanks for replying, Apologies as I was posting this from my phone.

    I have pasted in my web.config for my page. I am using the default page in IIS.

    I have the web app in ASP running continuously as it needs to keep the socket open between the server and laptop. however after a few minute the connection drops.

    When running the app in debug mode in Visual Studio on the localhost it all runs fine and for as long as I want. I am thinking its an IIS setting.

    You mentioned an error log but i don't get any error when the connection on my laptop drops, i just cant upload anymore data and i need to reset iis with IISRESET to allow me to reconnect to my laptop.

    Is there an automatic log stored somewhere?


    <compilation targetFramework="4.6.1" />
    <httpRuntime targetFramework="4.6.1" executionTimeout="21600" />
    <sessionState timeout="720" />
    <add namespace="System.Web.Optimization" />
    <add assembly="Microsoft.AspNet.Web.Optimization.WebForms" namespace="Microsoft.AspNet.Web.Optimization.WebForms" tagPrefix="webopt" />
    <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" />

    Friday, May 18, 2018 2:19 PM
  • User283571144 posted

    Hi cfcorp,

    I suggest you could try to check the IIS log for your application.

    Maybe it will contain some useful information.

    Without any error message, it is too strange the connection stop automatically.

    More details about how to check the IIS log, you could refer to below article.


    Best Regards,


    Monday, May 21, 2018 9:21 AM
  • User-1209441616 posted

    Hi Brando ZWZ,

    Ive had a look at the IIS logs from a session I did today after i reset IIS, I still get issues where the application stops taking in data after about 5 minutes or so.

    I posted the results below, basically I log in through Firefox to my ASP application and fill in some text boxes with names and hit start. An application running on a remote laptop should connect and upload any data I send to the ASP application in IIS. I have to press a "Start" button to get the ball rolling and the application goes and  conencts to the laptop and should read any data it sends. I want the ASP page to keep running until I stop it, but something seems to happen and the connection drops.

    In that case I have to close the browser and reset IIS to try another session. I am thinking that IIS times out or something?

    Thanks for your help

    #Software: Microsoft Internet Information Services 10.0
    #Version: 1.0
    #Date: 2018-05-22 08:48:53
    #Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status time-taken
    2018-05-22 08:48:53 GET /RaceConfig - 80 - Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64;+rv:61.0)+Gecko/20100101+Firefox/61.0 - 200 0 0 1109
    2018-05-22 08:48:59 GET / - 80 - Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64;+rv:61.0)+Gecko/20100101+Firefox/61.0 - 302 0 0 78
    2018-05-22 08:48:59 GET /Login Pg=Default 80 - Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64;+rv:61.0)+Gecko/20100101+Firefox/61.0 - 200 0 0 93
    2018-05-22 08:49:03 POST /Login Pg=Default 80 - Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64;+rv:61.0)+Gecko/20100101+Firefox/61.0 http://51.140.xxx.xxx/Login?Pg=Default 302 0 0 78
    2018-05-22 08:49:03 GET /RaceConfig.aspx - 80 - Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64;+rv:61.0)+Gecko/20100101+Firefox/61.0 http://51.140.xxx.xxx/Login?Pg=Default 301 0 0 87
    2018-05-22 08:49:03 GET /RaceConfig - 80 - Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64;+rv:61.0)+Gecko/20100101+Firefox/61.0 http://51.140.xxx.xxx/Login?Pg=Default 200 0 0 279
    2018-05-22 08:49:12 POST /RaceConfig - 80 - Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64;+rv:61.0)+Gecko/20100101+Firefox/61.0 http://51.140.xxx.xxx/RaceConfig 302 0 0 231
    2018-05-22 08:49:12 GET /RaceConfig.aspx Racename=tesff&guntime=12:01:09.999&Update=TRUE&CSVfile=C:\inetpub\wwwroot\UploadRunners\Copy%20of%20LHM%20Entry%20List%20Final.csv.csv 80 - Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64;+rv:61.0)+Gecko/20100101+Firefox/61.0 http://51.140.xxx.xxx/RaceConfig 301 0 0 78
    2018-05-22 08:54:18 GET / - 80 - Mozilla/5.0+(Windows+NT+6.1;+WOW64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/51.0.2704.103+Safari/537.36 - 302 0 0 250
    2018-05-22 08:55:58 GET /RaceConfig Racename=tesff&guntime=12:01:09.999&Update=TRUE&CSVfile=C:%5Cinetpub%5Cwwwroot%5CUploadRunners%5CCopy%20of%20LHM%20Entry%20List%20Final.csv.csv 80 - Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64;+rv:61.0)+Gecko/20100101+Firefox/61.0 http://51.140.xxx.xxx/RaceConfig 500 0 121 405277

    Tuesday, May 22, 2018 9:00 AM
  • User-1209441616 posted

    I made some progress, I set the keep alive interval to 5 minutes on the Windows Server VM in azure after the Azure timeout was set to 30 minutes and noticed that it worked.

    Thanks for your responses, I may have to test further but I got an hour out of the connection but got bored and left it at that.

    For anyone in the same boat, I used regedit and added the "KeepAliveTime" in the registry.

    the directory was HKLM\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters\ 

    I created a new DWORD and added the decimal value of 300000, which is 5 minutes.

    It seems to be working

    Wednesday, May 23, 2018 7:59 AM