AngularJS时,Internet Explorer文件上传60秒后悬 [英] AngularJS, Internet Explorer File Upload hanging after 60 seconds

查看:148
本文介绍了AngularJS时,Internet Explorer文件上传60秒后悬的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只使用IE出现一个不寻常的问题。

I have an unusual problem that only occurs with IE.

我在哪里上的变化事件被挂接到调用Web API服务作为一个如此角指令文件上传UI

I have a file upload UI where the on-change event is hooked up to an Angular Directive that calls a web api service as so

 element.on('change', event => {
    scope.onChange();

    if (event.target.files.length > 0) {

        var fd = new FormData();
        fd.append('file', event.target.files[0]);

        $http.post('/api/upload', fd, {
                transformRequest: angular.identity,
                headers: { 'Content-Type': undefined },
            })
            .success(data => {
                scope.onSuccess({ data: data });
            })
            .error(data => {
                scope.onError({ data: data });
            });
    }
});

这工作正常的Firefox和Chrome。它也能正常工作的IE浏览器,除非我回来的网页,然后等待60秒(工作正常,如果我等不到60秒)。

This works fine for Firefox and Chrome. It also works fine for IE unless I come back to the page and then wait for 60 seconds (works fine if I wait less than 60 seconds).

如果我等待60秒onchange事件仍在触发,后尝试,但从未达到API服务的要求是空的。这意味着xmlhtt prequest只是挂起:

If i wait 60 seconds the onchange event is still fired and the post is attempted, however, the API service is never reached as the request is empty. This means that the xmlhttprequest just hangs:


任何想法?

推荐答案

虽然上述修复的,你把它设置为这一段时间的问题是否意味着更改注册表。它也是一个软糖,而不是实际的修复问题的办法。

While the above fixes the issue for the period of time that you set it to it does mean a change to the registry. It is also a fudge rather than an actual fix to the problem.

我们的问题是,后没有被正确验证,再也没有回来。

Our problem was that the post wasn't being authenticated correctly and never came back.

做一个得到这个职位,强制认证,解决了这个问题之前,

Doing a GET before the POST forces the authentication and solves the issue

更新:这个链接给出了相似的,我们有这个问题<一个信息href=\"http://blogs.msdn.com/b/ieinternals/archive/2010/11/22/internet-explorer-post-bodies-are-zero-bytes-in-length-when-authentication-challenges-are-expected.aspx\" rel=\"nofollow\">http://blogs.msdn.com/b/ieinternals/archive/2010/11/22/internet-explorer-post-bodies-are-zero-bytes-in-length-when-authentication-challenges-are-expected.aspx

Update: This link gives info similar to the problem we had http://blogs.msdn.com/b/ieinternals/archive/2010/11/22/internet-explorer-post-bodies-are-zero-bytes-in-length-when-authentication-challenges-are-expected.aspx

这篇关于AngularJS时,Internet Explorer文件上传60秒后悬的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆