There are scenarios in which you need to send a large number of records to a database in LightSwitch or retrieve a large number of records. If the operation becomes too long, this might result in a fault due to a timeout exception. This typically happens if your data source is on a server or on a machine different than yours.
Solving timeout problems in LightSwitch can be done in several ways, some on the server side (as you would do in WCF RIA Services), but also on the client side. This requires making an edit to the Application.vb/cs file, which contains code that is common to the whole application.
To increase the timeout:
- in Solution Explorer, double-click Properties
- open Screen Navigation tab, then click "Click here to view application code"
- In the code editor, set the ClientTimeout property of the Details object with the desired value like in the following example:
Public Class Application
Private Sub Application_Initialize()
Me.Details.ClientTimeout = 1500
The assignment is done in the Initialize method hook, which runs at the application startup. In this way you can increase the timeout and allow long running operations on data.