ASP.NET Ajax Extender 컨트롤에서 WebMethod 통화 문제
-
11-12-2019 - |
문제
나는 Extender 컨트롤을 가지고 있으며 WebMethod에서 전화를 원합니다.그러나 sys.net.webserviceproxy.invoke도 $ .Ajax가 작동하지 않습니다.$ .AJAX 문제 서버 시간 초과 오류.작동하지만 웹 메소드는 호출하지 않습니다.코드는 아래 입니다
[WebMethod]
public static string calculateTime(string dateTime) {
return result;
}
.
WebMethod를 호출하는 Extender 컨트롤의 메서드입니다.
timer: function(){
Sys.Net.WebServiceProxy.invoke("CaculateTime.asmx", "calculateTime",false,{"dateTime":""+this._timestamp+""}, function (result, e){ this.get_element().innerText=result ;}, function(result, e){},"User Context", 100);
},
. 해결책 2
나는 경로 주소를 "calculateTime.asmx"로 사용하고 있었다.그러나 이것은 ASP.NET의 경우입니다.나는 "http : // localhost : 18194 / applicationname / calculate.asmx / calculateTime"이어야하므로 JavaScript에서 그것을 호출하고 있습니다.그것은 많은 시간을 낭비했습니다.
다른 팁
static
에서 calculateTime
수정 자를 제거합니다.나는 당신이 페이지 메서드와 혼동되었다고 믿습니다. 실제로 비동기가 전화를 걸 수있는 정적이어야합니다.
제휴하지 않습니다 StackOverflow