Jquery IE9 XmlHttpRequest返回12019错误,而不是HTTP/417响应代码
我在客户端处理对WCF服务的ajax请求时出错Jquery IE9 XmlHttpRequest返回12019错误,而不是HTTP/417响应代码,jquery,asp.net,wcf,internet-explorer,Jquery,Asp.net,Wcf,Internet Explorer,我在客户端处理对WCF服务的ajax请求时出错 self.remove = function (dep, processingResult) { var data = { "id": dep }; $.ajax({ url: 'my.svc/remove', type: 'POST', contentType: 'application/json',
self.remove = function (dep, processingResult) {
var data = { "id": dep };
$.ajax({
url: 'my.svc/remove',
type: 'POST',
contentType: 'application/json',
dataType: "json",
cache: false,
data: JSON.stringify(data),
complete: function (e, xhr, settings) {
var message = self.getMessage(e.status);
switch (e.status) {
case 200:
processingResult();
break;
case 417:
console.log(e.statusText);
radalert(message + e.statusText, null, null, "417");
break;
default:
{
console.log(e.statusText);
radalert(message, null, null, "bekey");
}
}
}
});
};
在某些情况下,我返回错误417,但IE9得到的结果却是错误12019。
包括IE10在内的所有其他浏览器都获得了正确的值
为什么会发生这种情况以及如何解决
12019-错误\u互联网\u不正确\u句柄\u状态
无法执行请求的操作,因为
提供的句柄未处于正确状态
看起来返回此代码不是很好的做法。我说得对吗
WebOperationContext ctx;
//....
ctx.OutgoingResponse.StatusCode = System.Net.HttpStatusCode.ExpectationFailed;//417
//...
如果清除缓存没有帮助,很可能这与URLMon如何包装某些HTTP错误状态代码有关;例如,IE9及以下版本将HTTP/204响应转换为伪造的1223状态代码(请参阅)
此问题在IE10中已修复,因此服务器的响应状态已正确返回到脚本。在旧版本的IE上出现了大量此问题。你能试试链接中的步骤吗?