我遇到了以下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: ""}
我尝试了什么(没有成功):
UseHttpGet = false
属性