【问题标题】:Jquery Ajax call works in all browser except ie 10Jquery Ajax 调用适用于除 ie 10 以外的所有浏览器
【发布时间】:2012-10-17 14:13:46
【问题描述】:

以下 ajax 调用适用于除 IE10 以外的所有浏览器(除非我将其设置为 IE9 标准模式) 我用 fiddler 看了一下,好像参数没有在 ie10 中通过任何想法?

var paramArray = '{"ID":1}';   

 $.ajax({
        type: 'POST',
        contentType: 'application/json; charset=utf-8',
        dataType: 'json',
        url: '/assets/services/coreWebServices.svc/GetCategoriesWithoutColumns',
        data: paramArray,
        success: successFn,
        error: errorFn
    });

抛出以下错误

The OperationFormatter could not deserialize any information from the Message because the Message is empty (IsEmpty = true).
    at System.ServiceModel.Dispatcher.PrimitiveOperationFormatter.DeserializeRequest(Message message, Object[] parameters)

System.Runtime.Serialization.SerializationException: Error in deserializing body of request message for operation 'GetCategoriesWithoutColumns'. The OperationFormatter could not deserialize any information from the Message because the Message is empty (IsEmpty = true).
    at System.ServiceModel.Dispatcher.PrimitiveOperationFormatter.DeserializeRequest(Message message, Object[] parameters)\u000d\u000a
    at System.ServiceModel.Dispatcher.DemultiplexingDispatchMessageFormatter.DeserializeRequest(Message message, Object[] parameters)\u000d\u000a
    at System.ServiceModel.Dispatcher.UriTemplateDispatchFormatter.DeserializeRequest(Message message, Object[] parameters)\u000d\u000a
    at System.ServiceModel.Dispatcher.CompositeDispatchFormatter.DeserializeRequest(Message message, Object[] parameters)\u000d\u000a
    at System.ServiceModel.Dispatcher.DispatchOperationRuntime.DeserializeInputs(MessageRpc& rpc)\u000d\u000a
    at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)\u000d\u000a
    at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)\u000d\u000a
    at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage41(MessageRpc& rpc)\u000d\u000a
    at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc)\u000d\u000a
    at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc)\u000d\u000a
    at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc& rpc)\u000d\u000a
    at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc& rpc)\u000d\u000a
    at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc)\u000d\u000a
    at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc& rpc)\u000d\u000a
    at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)

System.ServiceModel.CommunicationException: Error in deserializing body of request message for operation 'GetCategoriesWithoutColumns'. The OperationFormatter could not deserialize any information from the Message because the Message is empty (IsEmpty = true).
    at System.ServiceModel.Dispatcher.PrimitiveOperationFormatter.DeserializeRequest(Message message, Object[] parameters)\u000d\u000a
    at System.ServiceModel.Dispatcher.DemultiplexingDispatchMessageFormatter.DeserializeRequest(Message message, Object[] parameters)\u000d\u000a
    at System.ServiceModel.Dispatcher.UriTemplateDispatchFormatter.DeserializeRequest(Message message, Object[] parameters)\u000d\u000a
    at System.ServiceModel.Dispatcher.CompositeDispatchFormatter.DeserializeRequest(Message message, Object[] parameters)\u000d\u000a
    at System.ServiceModel.Dispatcher.DispatchOperationRuntime.DeserializeInputs(MessageRpc& rpc)\u000d\u000a
    at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)\u000d\u000a
    at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)\u000d\u000a
    at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage41(MessageRpc& rpc)\u000d\u000a
    at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc)\u000d\u000a
    at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc)\u000d\u000a
    at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc& rpc)\u000d\u000a
    at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc& rpc)\u000d\u000a
    at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc)\u000d\u000a
    at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc& rpc)\u000d\u000a
    at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)

【问题讨论】:

  • 你能提供小提琴吗?
  • 您是否安装了“免费下载管理器”插件(或任何类似插件)?已知会导致此问题(即使您在 IE 的管理加载项中禁用它)。

标签: ajax internet-explorer-10


【解决方案1】:

这似乎是带有 IE10 的 jQuery 中的一个错误(至少是 Windows 7 预览版)。 POST 数据未在请求中发送,我已将错误的详细信息记录到 jQuery:http://bugs.jquery.com/ticket/12790#comment:18

更新:就我而言,这是免费下载管理器中的一个错误导致 IE10 出现问题。他们有fixed the issue(3.9.2 build 1281.-2012 年 12 月 26 日),所以效果很好。如果您阅读上面 jQuery 链接中的 cmets,您可以看到有人也选择了它,并且卸载 FDM 也纠正了该问题。所以这不是 IE10 或 jQuery 的问题,而是一个改变正常行为的附加组件。

【讨论】:

  • “免费下载管理器”是浏览器插件还是单独的软件?
  • @JustinJason:FDM 是一个单独的软件 (freedownloadmanager.org),尽管它还安装了一个插件以与 IE 集成,例如拦截下载请求和链接点击。正是这个插件在 IE10 中干扰了 AJAX 调用。
【解决方案2】:

就我而言,下载加速器 Plus 是原因。卸载 DAP 解决了该问题。

【讨论】:

    【解决方案3】:

    我知道很久以前有人问过这个问题,但想添加我的答案。

    这不是 IE 或 jquery 的错误。 DAP、FDM 和 IDM 等一些下载管理器会导致此问题(即使已禁用)。删除这些下载管理器会起作用。

    问题在于这些下载管理器有一个对某些 URLMon 接口的不完整 thunk,这会干扰 POST 上传

    很少有人报告说 Google Gears 也对这个问题负责。禁用后,问题将解决。(未测试)

    【讨论】:

      【解决方案4】:

      在 IE10 中无法通过 ajax 请求中的每个 POST 发送数据(即使在我的情况下没有安装可能干扰 IE10 的其他程序)。在 ajax 请求中按 GET 发送数据对我有用。

      起初,根据 JavaScript 错误控制台,这似乎是 jquery 问题和 JSON 数据问题(如错误编码或非法字符或无效 json),分别在响应中发送回 json 数据时,但一切都是对 json 数据很好。然后我发现没有发送 POST 数据,我将 jquery $.ajax 调用中的“type”参数更改为“GET”,从而解决了问题。

      【讨论】:

        【解决方案5】:

        我在 IE10/jQuery 1.11.1 中对 FormData 对象的 Ajax POST 请求遇到了同样的问题。 POST 数据和文件附件都没有发送到服务器。只发送了 URL 参数。

        我正在使用此补丁向 jQuery Ajax 添加进度回调:

        https://github.com/englercj/jquery-ajax-progress

        没有补丁,请求在 IE10 中完美运行。

        该补丁在所有其他浏览器中都能完美运行。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2011-08-11
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多