ASP.NET网站的Internet Explorer 10速度非常慢 [英] ASP.NET website very slow Internet Explorer 10

查看:260
本文介绍了ASP.NET网站的Internet Explorer 10速度非常慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

场景

我有一个ASP.NET网站,该网站在Internet Explorer 8中可以完美运行,但在Internet Explorer 10中却非常慢.

I have an ASP.NET website that works perfectly in Internet explorer 8, but is extremely slow in Internet Explorer 10.

问题

在Internet Explorer 8中,回发或按钮单击事件大约需要1.5秒才能完成.在Internet Explorer 10中,该过程至少需要30秒,有时甚至超过60秒.

In Internet Explorer 8 a postback or button click event takes about 1,5 seconds to complete. In internet explorer 10 it takes a minimum of 30 seconds and sometimes over 60 seconds.

我已经尝试过的东西

1.从Microsoft网站安装了修补程序以更新浏览器定义文件 ( http://support.microsoft.com/kb/2836939 )

1.Installed a hotfix from Microsoft's website to update the browser definition files (http://support.microsoft.com/kb/2836939)

  1. 我尝试在web.config中强制使用IE8和IE9兼容模式,或者在IIS中或直接在html页面中添加HTTP标头.

  1. I tried forcing IE8 and IE9 Compatibility Mode in web.config or adding HTTP Header in IIS or directly inside html pages.

试图在服务器(Windows Server 2008 R2)上的ISS中更改应用程序池.

Tried changing the application pool in ISS on the server(Windows server 2008 R2).

在客户端计算机上安装.NET Framework 4.0

Installing .NET framework 4.0 on client machine

真实问题

ASP.NET在将Internet Explorer 10作为浏览器进行检测时是否仍然存在问题,或者浏览器之间的响应时间过长是否会成为Web服务器(浏览器定义文件等)上的问题?

Could ASP.NET still be having issues detecting Internet Explorer 10 as a browser, or could the slow response time between the browsers be a problem on the web server(browser definition files etc.)?

推荐答案

使用Internet Explorer浏览包含UpdatePanel的页面时,单击页面后会有延迟(通常在10秒到45秒之间或更长时间)发起异步回发的元素.使用Internet Explorer以外的浏览器时,不会遇到延迟.

When using Internet Explorer to browse a page that contains an UpdatePanel, there is a delay (often anywhere between 10 seconds and 45 seconds or more) after clicking a page element that initiates an async postback. The delay is not experienced when using browsers other than Internet Explorer.

在启动异步回发之前,PageRequestManager的_destroyTree方法迭代UpdatePanel内部的DOM元素,以处理DOM元素. _destroyTree方法的特定实现在Internet Explorer中在某些条件下使用大型DOM树时非常慢,这是由于Internet Explorer的HTML查看器(mshtml.dll)将DOM元素存储在内存中的方式.

The PageRequestManager's _destroyTree method iterates through the DOM elements inside of the UpdatePanel prior to initiating an async postback in order to dispose of DOM elements. The _destroyTree method's specific implementation is very slow in Internet Explorer when working with a large DOM tree under some conditions due to the way that Internet Explorer's HTML viewer (mshtml.dll) stores DOM elements in memory.

在页面的关闭</body>元素遇到延迟之前,立即在下面添加JavaScript.

Add the JavaScript below immediately before the closing </body> element of the page experiencing the delay.

<script language="javascript" type="text/javascript">

  function disposeTree(sender, args) {
    var elements = args.get_panelsUpdating();
    for (var i = elements.length - 1; i >= 0; i--) {
        var element = elements[i];
        var allnodes = element.getElementsByTagName('*'),
            length = allnodes.length;
        var nodes = new Array(length)
        for (var k = 0; k < length; k++) {
            nodes[k] = allnodes[k];
        }
        for (var j = 0, l = nodes.length; j < l; j++) {
            var node = nodes[j];
            if (node.nodeType === 1) {
                if (node.dispose && typeof (node.dispose) === "function") {
                    node.dispose();
                }
                else if (node.control && typeof (node.control.dispose) === "function") {
                    node.control.dispose();
                }

                var behaviors = node._behaviors;
                if (behaviors) {
                    behaviors = Array.apply(null, behaviors);
                    for (var k = behaviors.length - 1; k >= 0; k--) {
                        behaviors[k].dispose();
                    }
                }
            }
        }
        element.innerHTML = "";
    }
}
Sys.WebForms.PageRequestManager.getInstance().add_pageLoading(disposeTree);

</script>

这篇关于ASP.NET网站的Internet Explorer 10速度非常慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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