My Azure web role uses Ajax to call a function (in default.aspx.cs) that delegates work to worker roles. Worker roles may take up to 30-40 minutes depending on input file selected by user. If the worker roles return the result quickly it is received by the webrole and displays correctly on the web page. If it takes long the results are still received by the webrole (tried printing to trace) but nothing gets displayed on the web page.
I feel there is some kind of time out that kills the connection between the ajax code on the page and the webrole.
The code looks like:
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<script type="text/javascript" src="Scripts/jquery-1.4.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$("#btnSubmit").click(function () {
var params = '{ map1 : "' + document.getElementById('<%=ddlMap1.ClientID %>').value + '",' +
'map2 : "' + document.getElementById('<%=ddlMap2.ClientID %>').value + '",' +
'op : "' + document.getElementById('<%=ddlOperator.ClientID %>').value + '"}';
$('#spinner').show();
$('#results').text('');
$.ajax({
type: "POST",
url: "Default.aspx/Overlay",
data: params,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
var dmsg = '';
if (msg == null) {
dmsg = 'null';
} else {
dmsg = msg.d;
}
$('#spinner').hide();
$('#results').text(dmsg);
},
error: function (error) {
$('#results').text('');
}
});
});
});
</script>