简体   繁体   English

在生产环境而不是开发环境中加载页面时,脚本无响应

[英]Unresponsive script when loading page in production, but not in development

I'm trying to use JQuery UI's sortable functionality(see http://jqueryui.com/sortable/ ) for scheduling work assignments by dragging from a list of jobs to an employee, by date. 我正在尝试使用JQuery UI的可排序功能(请参阅http://jqueryui.com/sortable/ )通过按日期从作业列表拖动到员工来安排工作分配。

It looks fine on my development environment. 在我的开发环境上看起来还不错。 It loads quickly and works correctly. 它加载迅速且工作正常。 However, when I publish to my production server and try to load the same page on my production site it locks up. 但是,当我发布到生产服务器并尝试在生产站点上加载同一页面时,它会锁定。

After waiting a while and telling the unresponsive page to stop, I get the following error in the console in Firefox: 等待一会儿并告诉无响应的页面停止后,我在Firefox的控制台中收到以下错误:

Error: Script terminated by timeout at:
w</u.uniqueSort@http://productionserver/bundles/jquery?v=v5ipibJm7AKDxo-gwvDlrhtKDuuTixthciRUzTvH4GU1:1:122745
add@http://productionserver/bundles/jquery?v=v5ipibJm7AKDxo-gwvDlrhtKDuuTixthciRUzTvH4GU1:1:133074
_on@http://productionserver/bundles/jqueryui?v=tG29gr4b89aZuHZhwb2RRduOLQe69zZ-D0yHV7Mp9SM1:1:9595
_classes@http://productionserver/bundles/jqueryui?v=tG29gr4b89aZuHZhwb2RRduOLQe69zZ-D0yHV7Mp9SM1:1:8850
_toggleClass@http://productionserver/bundles/jqueryui?v=tG29gr4b89aZuHZhwb2RRduOLQe69zZ-D0yHV7Mp9SM1:1:9474
_addClass@http://productionserver/bundles/jqueryui?v=tG29gr4b89aZuHZhwb2RRduOLQe69zZ-D0yHV7Mp9SM1:1:9266
_setHandleClassName/<@http://productionserver/bundles/jqueryui?v=tG29gr4b89aZuHZhwb2RRduOLQe69zZ-D0yHV7Mp9SM1:1:204369
each@http://productionserver/bundles/jquery?v=v5ipibJm7AKDxo-gwvDlrhtKDuuTixthciRUzTvH4GU1:1:110253
_setHandleClassName@http://productionserver/bundles/jqueryui?v=tG29gr4b89aZuHZhwb2RRduOLQe69zZ-D0yHV7Mp9SM1:1:204340
n.widget/</h[t]</<@http://productionserver/bundles/jqueryui?v=tG29gr4b89aZuHZhwb2RRduOLQe69zZ-D0yHV7Mp9SM1:1:4508
refresh@http://productionserver/bundles/jqueryui?v=tG29gr4b89aZuHZhwb2RRduOLQe69zZ-D0yHV7Mp9SM1:1:213332
n.widget/</h[t]</<@http://productionserver/bundles/jqueryui?v=tG29gr4b89aZuHZhwb2RRduOLQe69zZ-D0yHV7Mp9SM1:1:4508
_create@http://productionserver/bundles/jqueryui?v=tG29gr4b89aZuHZhwb2RRduOLQe69zZ-D0yHV7Mp9SM1:1:204024
n.widget/</h[t]</<@http://productionserver/bundles/jqueryui?v=tG29gr4b89aZuHZhwb2RRduOLQe69zZ-D0yHV7Mp9SM1:1:4508
_createWidget@http://productionserver/bundles/jqueryui?v=tG29gr4b89aZuHZhwb2RRduOLQe69zZ-D0yHV7Mp9SM1:1:6648
n.widget/n[e][t]@http://productionserver/bundles/jqueryui?v=tG29gr4b89aZuHZhwb2RRduOLQe69zZ-D0yHV7Mp9SM1:1:4069
n.widget.bridge/n.fn[t]/<@http://productionserver/bundles/jqueryui?v=tG29gr4b89aZuHZhwb2RRduOLQe69zZ-D0yHV7Mp9SM1:1:5885
each@http://productionserver/bundles/jquery?v=v5ipibJm7AKDxo-gwvDlrhtKDuuTixthciRUzTvH4GU1:1:110253
each@http://productionserver/bundles/jquery?v=v5ipibJm7AKDxo-gwvDlrhtKDuuTixthciRUzTvH4GU1:1:108205
n.widget.bridge/n.fn[t]@http://productionserver/bundles/jqueryui?v=tG29gr4b89aZuHZhwb2RRduOLQe69zZ-D0yHV7Mp9SM1:1:5790
@http://productionserver/JobScheduling/MainJobBoard/:6304:7
c@http://productionserver/bundles/jquery?v=v5ipibJm7AKDxo-gwvDlrhtKDuuTixthciRUzTvH4GU1:1:134341
fireWith@http://productionserver/bundles/jquery?v=v5ipibJm7AKDxo-gwvDlrhtKDuuTixthciRUzTvH4GU1:1:135109
ready@http://productionserver/bundles/jquery?v=v5ipibJm7AKDxo-gwvDlrhtKDuuTixthciRUzTvH4GU1:1:136894
v@http://productionserver/bundles/jquery?v=v5ipibJm7AKDxo-gwvDlrhtKDuuTixthciRUzTvH4GU1:1:94196

I was thinking it might have something to do with bundling or minifying of scripts, but when I set BundleTable.EnableOptimizations = true; 我以为它可能与捆绑或缩小脚本有关,但是当我设置BundleTable.EnableOptimizations = true; in BundleConfig.cs and run it in Visual Studio everything worked fine. 在BundleConfig.cs中运行,并在Visual Studio中运行,一切正常。 I also tried running in Release and setting compilation debug="false" in Web.config. 我还尝试在Release中运行并在Web.config中设置compilation debug="false" Both worked fine. 两者都很好。

For reference, here's my BundleConfig.cs RegisterBundles method: 作为参考,这是我的BundleConfig.cs RegisterBundles方法:

    bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
    "~/Scripts/jquery-ui-{version}.js"));

    bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                "~/Scripts/jquery-{version}.js"));

    bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
                "~/Scripts/jquery.validate*"));


    bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
                "~/Scripts/modernizr-*"));


    bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
              "~/Scripts/bootstrap.js",
              "~/Scripts/bootstrap-datepicker.js",
              "~/Scripts/DatePickerReady.js",
              "~/Scripts/respond.js"));

    bundles.Add(new StyleBundle("~/Content/jqueryuicss").IncludeDirectory("~/Content/themes/base", "*.css", false));

    bundles.Add(new StyleBundle("~/Content/css").Include(
              "~/Content/bootstrap.css",
              "~/Content/bootstrap-datepicker3.css",
              "~/Content/site.css"));

What could be causing my page to lock up in production, but not in development? 是什么导致我的页面锁定在生产环境中,而不是开发环境? What do I need to change? 我需要更改什么?

Any help would be appreciated. 任何帮助,将不胜感激。

It looks like it was caused by loading a very large amount of items one of the lists. 看来这是由于加载了其中一个列表中的大量项目引起的。 I had several hundred items in one list and about two hundred total lists. 我在一个列表中有几百个项目,总共有约200个列表。 In my development environment I was only loading a relatively small amount of test data, about forty items at most in a list with the same number of lists. 在我的开发环境中,我仅加载相对少量的测试数据,在具有相同数量列表的列表中,最多最多包含40个项目。

I just need to make sure I limit the amount of data being displayed to a reasonable amount. 我只需要确保将显示的数据量限制在合理的数量即可。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM