I am calling a server-side webmethod from inside a javascript loop on the client via a Pagemethods call. The loop is exactly 300 items and the calls to the server are all sent quickly and pile up on the server. See below:
Javascript
==================================
for (i = 0; i < selectedValues.length; i++) {
PageMethods.WM_PostInvoice(strParamList, OnSuccessCallback, OnFailureCallback);
}
Webmethod on Server
==================================
Public Shared Function WM_PostInvoice(ByVal strParamList As String) As String
Try
'Threading.Thread.Sleep(900) 'OK - 900 milliseconds(0.9 seconds) X 300 requests = 270 seconds = 4.5mins
'Threading.Thread.Sleep(1000) 'OK - 1000 milliseconds(1 second) X 300 requests = 300 seconds = 5mins
'Threading.Thread.Sleep(1100) 'Fails - 1100 milliseconds(1.1 seconds) X 330 requests = 270 seconds = 5.5mins
'Threading.Thread.Sleep(1200) 'Fails - Etc.
'Threading.Thread.Sleep(1500) 'Fails - Etc.
' strReturn &= "|0|Success!"
Catch ex As Exception
strReturn &= "|-1|Error: " & ex.Message
End Try
Return strReturn
End Function
The problem I'm having is, whenever the sum of the call totals over 5 minutes, all calls AFTER 5 minutes fail. Any suggestions to make calls that have been qued but not processed within 5 minutes not fail? I have tried changing lots of setting without any success. See below.
On the page
=============================
<%@ Page Title="" ...... AsyncTimeout="800" %>
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true" AsyncPostBackTimeout="600" >
On the code behind page
=============================
Server.ScriptTimeout = 3600
Web.config
=============================
<httpRuntime executionTimeout="600" />
<sessionState timeout="90" />