locked
Lightswitch Inactivity Timeout RRS feed

  • Question

  • I've seen a couple other timeout questions posted here, but the solutions have not fixed my issues. I've increased my session timeout to 480 minutes and did the same with my form authentication timeout. My issue appears to be related to inactivity. It seems that when I stop using the application for 5 minutes (I tried 4 minute intervals and have not encountered the issue), the next attempt to get data from the server will result in a screen for of red X. The only way to resolve is to refresh the web page and relogin.

    Is there another time out used by RIA services or Entity Framework that would cause this situation?

    Thanks!

    Jay

    Thursday, May 12, 2011 5:02 PM

Answers

  • So far, this is the only thing that seems to solve the problem and stop the little red X's from showing up after 5 minutes of inactivity:

     

    namespace LightSwitchApplication
    {
      public partial class Application
      {
        private Timer _timer;
    
        partial void Application_LoggedIn()
        {
    
          if (_timer == null)
          {
            _timer = new Timer(x =>
            {
              this.Details.Dispatcher.BeginInvoke(() =>
              {
                var item = this.CreateDataWorkspace().ApplicationData.<strong>OneOfYourEntitySets</strong>.FirstOrDefault();
              });
    
            }, null, 15000, 30000);
          }
        }
      }
    }
    


    Jay Turpin
    Sunday, May 22, 2011 9:23 PM

All replies

  • Hi Jay,

    If I remember correctly, this "inactivity timeout" is "by design", & I don't believe there is a way in V1 for you to change that.

    I do know the team is aware of the issue, & therefore they *may* provide a way for developers to change the timeout value in the future.

    If you feel strongly about it, I suggest you post a suggestion on the Connect website, & post a link to the submission here, so that others who feel strongly about it can add their votes as well.

    Yann 


    • Proposed as answer by Yann Duran Thursday, May 12, 2011 11:28 PM
    • Edited by Yann Duran Wednesday, July 6, 2011 10:29 AM Tidied link
    Thursday, May 12, 2011 11:28 PM
  • I would be very surprised if you cannot change the timeout as it would be using standard WCF underneath and I cannot see why the LS team would have changed the timeout behavior.

    I think this is the thread you want:

    http://social.msdn.microsoft.com/Forums/en-US/lightswitchgeneral/thread/e6659482-b05d-4567-a44a-03a0b5bdb282


    Xander
    Thursday, May 12, 2011 11:53 PM
  • Hi Xander,

    What I meant is that there is no "exposed" way to change the value. Of course you're right, you can do lots of things, if you know where to dig & what to change etc. :-)

    That link should help Jay, if he wants to go digging under the covers to change the value.

    Yann

     

     

    Friday, May 13, 2011 12:15 AM
  • Hi Yann,

    LS could allow you to set a default for this in say the LS project properties, but you'd still need to be able to change it in the configuration file once deployed (if you need to change it again). Having worked in corporate environments for many years, I know that they have very strict security policies on website timeouts and you need to approach a committee for formal approval before making any changes to that.

    Maybe all we need as part of RTM is good FAQ on how and where to adjust important aspects like this timeout issue. These forums should provide a good list of topics to cover.

    Regards


    Xander
    Friday, May 13, 2011 10:37 PM
  • @Xander:  Hear, hear!  The FAQ sheet is a great idea.

    http://en.wikipedia.org/wiki/Hear,_hear

     

    Friday, May 13, 2011 11:57 PM
  • Absolutely!
    Saturday, May 14, 2011 11:06 PM
  • Thanks for the ideas. However the link didn't really help. I've already increased the timeouts for both sessionState and authentication:

        <authentication mode="Forms">

          <forms name="MyLsApp" timeout="480" />

        </authentication>

    <sessionState timeout="480" />
    I also increased the recycle timeout for the app pool. Is there another one buried in WCF I can look for. 
    Or, is there a good place to catch this exception in the service layer and handle it more gracefully?
    Thanks

    Saturday, May 21, 2011 1:57 PM
  • I just stumbled upon the LightswitchApplication.Application.Details.ClientTimeout property. Does anyone have any idea what it's purpose is? Are the values seconds or minutes? I'm going to experiment with it to see if it will solve my problem.
    Jay Turpin
    Sunday, May 22, 2011 5:08 PM
  • So far, this is the only thing that seems to solve the problem and stop the little red X's from showing up after 5 minutes of inactivity:

     

    namespace LightSwitchApplication
    {
      public partial class Application
      {
        private Timer _timer;
    
        partial void Application_LoggedIn()
        {
    
          if (_timer == null)
          {
            _timer = new Timer(x =>
            {
              this.Details.Dispatcher.BeginInvoke(() =>
              {
                var item = this.CreateDataWorkspace().ApplicationData.<strong>OneOfYourEntitySets</strong>.FirstOrDefault();
              });
    
            }, null, 15000, 30000);
          }
        }
      }
    }
    


    Jay Turpin
    Sunday, May 22, 2011 9:23 PM
  • Sunday, May 22, 2011 9:36 PM
  • Thanks for your investigations Jay, it is much appreciated.

    Can we please ask someone from the LS team to comment on this issue as it is *very important* and is likely to be encountered by every LS developer sooner or later. We need a definitive response form the LS team as to what the situation on this is with regards to RTM.

    Thanks


    Xander
    Sunday, May 22, 2011 10:13 PM
  • Hi Jay,

    Voted +1

    I also appreciate your efforts in investigating this, & sharing your results here.

    Yann

    Sunday, May 22, 2011 11:19 PM
  • Hi Jay,

    Voted +1

    Thursday, June 9, 2011 9:43 AM