我有一个扩展器控制,并希望从中呼叫WebMethod。但既不是sys.net.webserviceproxy.invoke也没有$ .ajax工作。$ .ajax问题服务器超时错误。调用工作但不调用Web方法。代码低于

   [WebMethod]
public static string calculateTime(string dateTime) {

    return result;
}
.

调用webmethod的扩展器控件中的方法。

  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是这种情况。我正在从javascript中致电它,所以它应该是“http:// localhost:18194 / applicationname / calculate.asmx / calmulatetime”。它浪费了很多时间。

其他提示

static中删除calculateTime修改器。我相信你对页面方法感到困惑,那些确实必须是静态来允许异步呼叫。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top