对asmx-Service的AJAX请求获取错误500“处理请求时出错”。

时间:2015-10-22 22:09:29

标签: c# jquery ajax sharepoint-2010 asmx

我遇到了以下ajax请求的问题,该问题工作正常,但在另一台虚拟机上。由于简单的原因,我保持示例简单。

这是我的带有GetData方法的asmx-WebService:

        [WebService(Namespace = "http://tempuri.org/")]
            [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
            [System.ComponentModel.ToolboxItem(false)]
            [ScriptService]
            class CpmService
            {
                [WebMethod]
                [ScriptMethod(UseHttpGet = false, ResponseFormat = ResponseFormat.Json)]
                public object GetData(string WebId)
                {  return new{Result = result};   }
            }

和AJAX请求:

 $.ajax({
                type: "POST",
                url: serviceURL + "/GetData",
                contentType: 'application/json; charset=utf-8',
                dataType: "json",
                data:  '{"":""}', //'{"WebId":"'  + curWeb.get_id() +'"}',
                success: doFirst,
                error: doSecond
    });

只执行错误处理程序doSecond,但从不执行doFirst方法。错误信息是:

{Message: "There was an error processing the request.", StackTrace: "", ExceptionType: ""}

我尝试了什么(没有成功):

  • 重新格式化AJAX请求的数据参数“{”“:”“}'或{”WebId“:”'+ curWeb.get_id()+'“}',或”“或”{}“等等。
  • 从Web服务方法GetData
  • 中删除UseHttpGet = false属性
  • 在Stackoverflow中搜索解决方案

0 个答案:

没有答案