웹 서비스에 대한 AJAX 및 Asynch 호출에 대해 2 가지 질문이 있습니다.AJAX 호출 WebService 병렬 최대 프로세스 및 중단
1) 페이지가로드되면 18 개의 AJAX 요청이 웹 서비스 페이지 ASMX에 발생합니다. 다음 그림에서 볼 수 있듯이 처음에는 6 개의 요청 만 처리되고 그 중 하나가 완료되면 다른 하나가 승인됩니다.
동시에 처리되는 tak의 최대 수를 늘리려면 어떻게해야합니까? 6 AJAX 코드의
하나 (18)에서 :
<script type="text/javascript">
var myRetourboxUn;
function RechercherInterventionboxUn()
{
myRetourboxUn = $.ajax({
type: "POST",
timeout: 30000,
cache: false,
url: "/TestAsynch/InterventionRecherche.asmx/HelloWorld",
data: ({}),
dataType: "text",
beforeSend: function(){
$("#tdboxUn").children(".divContenu").hide();
$("#tdboxUn").children(".divChargement").show();
}
}).done(function(msg){
$("#tdboxUn").children(".divContenu").show();
$("#tdboxUn").children(".divChargement").hide();
$("#tdboxUn").children(".divContenu").html("--" + msg);
}).fail(function(jqXHR, textStatus, errorThrown){
$("#tdboxUn").children(".divContenu").show();
$("#tdboxUn").children(".divChargement").hide();
$("#tdboxUn").children(".divContenu").text(textStatus);
});
$(".menu").click(function(){
myRetourboxUn .abort();
});
}
$(function(){
RechercherInterventionboxUn();
});
$(window).unload(function() {
//myRetourboxUn .abort();
});
</script>
하는 WebService에 코드 : 나는 페이지를 새로 고침 할 때
<System.Web.Services.WebService(Namespace:="http://tempuri.org/")> _
<System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<ToolboxItem(False)> _
Public Class InterventionRecherche
Inherits System.Web.Services.WebService
<WebMethod()> _
Public Function HelloWorld() As String
Dim aTemps As DateTime = DateTime.Now
Dim aTest As Integer = 1
Do While aTest < 100000000
aTest += 1
Loop
Return (DateTime.Now - aTemps).ToString
End Function
<WebMethod()> _
Public Function HelloWorld3() As String
Dim aTemps As DateTime = DateTime.Now
Dim aTest As Integer = 1
Do While aTest < 100000000
aTest += 1
Loop
Return (DateTime.Now - aTemps).ToString
End Function
End Class
2), 모든 요청 될 때까지 냉동 유지 완료되었습니다. 페이지를 언로드 할 때 기다리지 않고 요청을 자동 종료하는 방법은 무엇입니까?
분명히이 동작은 Chrome과 마찬가지로 IE에서만 발생하며 페이지를 변경하려는 경우에는 문제가 발생하지 않습니다. 요청이 잘못 도착한 후 페이지가 즉시 다시로드됩니다.
감사합니다.