我有一个简单的设置。
jQuery的:
$.ajax({
url: "/MyApp/MyHandler.ashx/MyMethod",
success: function(result) {
alert("sucess");
},
error: function() {
alert('Error');
}
});
和网络方法:
[System.Web.Services.WebMethod]
public static void MyMethod(){
new AnotherClass(null).AnotherMethod(null, null);
}
问题是成功警报被调用但是在MyMethod
内部没有击中断点。
我遇到了同样的问题,这是我最终要做的事情:
$.ajax({
url: _url,
data: '',
dataType: 'json',
contentType: 'application/json',
type: 'POST',
success: function(result) {
alert("sucess");
},
error: function() {
alert('Error');
}
});
我的第一次尝试遗漏了qazxsw poi,qazxsw poi和qazxsw poi;只有当我用一个空字符串(data
)设置dataType
时,它最终才能正常工作。真痛十足 - 希望这有助于其他人!
在我的情况下,问题出现在RoutingConfig.So中,在RouteConfig中的App_Start文件夹中排序,注释掉以下行
//settings.AutoRedirectMode = RedirectMode.Permanent;