C# 对asmx服务的AJAX请求出现错误500“;处理请求时出错。”;
我对下面的ajax请求有一个问题,它工作得很好,但是在另一个虚拟机上。由于简单的原因,我将示例保持简单 这是我的带有GetData方法的asmx Web服务:C# 对asmx服务的AJAX请求出现错误500“;处理请求时出错。”;,c#,jquery,ajax,sharepoint-2010,asmx,C#,Jquery,Ajax,Sharepoint 2010,Asmx,我对下面的ajax请求有一个问题,它工作得很好,但是在另一个虚拟机上。由于简单的原因,我将示例保持简单 这是我的带有GetData方法的asmx Web服务: [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [System.ComponentModel.Toolb
[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中搜索解决方案