【问题标题】:JavaScript runtime error: Not enough storage is available to complete this operation. in angularjsJavaScript 运行时错误:没有足够的存储空间来完成此操作。在 Angular.js 中
【发布时间】:2015-07-02 22:51:59
【问题描述】:

我有四个服务调用函数用于屏幕中的下拉绑定,我正在使用angularjs http 调用从WEB API 服务获取数据。

以下是方法

 function loadProjects() {
            $http({
                method: 'GET',
                url: rootUrl + '/api/Project/ProjectList',
                headers: {
                    'Content-Type': "application/json; charset=utf-8"
                }
            }).success(function (response) {
                response.push({ ProjectName: "Select", ProjectId: 0 });
                $scope.ProjectList = response;
                $scope.SelectedProject = response[$scope.ProjectList.length - 1];
            }).error(function (response, errorCode) {
                if (errorCode == 444) {
                    //toastr.error('Your email address is does not verrified ', 'Error');
                }
            })
        }
        function loadTasks() {
            $http({
                method: 'GET',
                url: rootUrl + '/api/Task/TaskList',
                headers: {
                    'Content-Type': "application/json; charset=utf-8"
                }
            }).success(function (response) {
                $scope.TaskList = response;
            }).error(function (response, errorCode) {
                if (errorCode == 444) {
                    //toastr.error('Your email address is does not verrified ', 'Error');
                }
            })
        }
        function loadStatus() {
            $http({
                method: 'GET',
                url: rootUrl + '/api/Status/GetAllStatus',
                headers: {
                    'Content-Type': "application/json; charset=utf-8"
                }
            }).success(function (response) {
                response.push({ StatusTypeName: "Select", StatusTypeId: 0 });
                $scope.StatusType = response;
                $scope.SelectedStatusType = response[$scope.StatusType.length - 1];
            }).error(function (response, errorCode) {
                if (errorCode == 444) {
                    //toastr.error('Your email address is does not verrified ', 'Error');
                }
            })
        }
        function loadUserList() {
            $http({
                method: 'GET',
                url: rootUrl + '/api/Account/ListOfUsers',
                headers: {
                    'Content-Type': "application/json; charset=utf-8"
                }
            }).success(function (response) {
                response.push({ FirstName: "Select", UserId: 0 });
                $scope.UserList = response;
                $scope.SelectedUser = response[$scope.UserList.length - 1];
            }).error(function (response, errorCode) {
                if (errorCode == 444) {
                    //toastr.error('Your email address is does not verrified ', 'Error');
                }
            })
        }

上面的函数我已经一一调用了。

loadUserList();
loadProjects();
loadStatus();
loadTasks();

HTML : I have binding the four dropdown by this way

<select style="width: 160px" ng-model="SelectedTask" class="form-control" name="SelectedTask"
                        ng-options="tasklist.TaskName for tasklist in  TaskList">
                    </select>

前两个函数从WEBAPI 获取一些数据非常慢,我的数据库只有 5 行。但很慢。但我在另一个屏幕上使用相同的功能,效果很好。

每当loadStatus(); (第三个函数) 函数调用时,我都会收到此错误消息。

错误消息是:JavaScript 运行时错误:没有足够的存储空间来完成此操作。在 angularjs 中

当我运行其他一些屏幕与检测到问题的屏幕时,我还将显示性能详细信息。

查看CPU 的用法。我找不到解决方案。请帮帮我。

我也从谷歌得到了一些答案,但他们说这是一个视觉工作室的问题。但我认为这不是问题。因为其他屏幕运行良好。请帮帮我;)提前谢谢

【问题讨论】:

  • 你的javascript错误只在IE中吗?
  • 是的,我只在 IE 中遇到了这个错误。其他浏览器不显示任何错误。但我只遇到了性能问题。
  • 嗯,k。您是否尝试过检查 ajax 调用中的响应?我只是想确认您没有拉入您不想要的东西。例如,一个 ORM 可能会意外地拉入连接的表,最终您会得到一个巨大的模型对象,而不是您期望的一小行。
  • 另外,您是否尝试过使 ajax 调用同步(不理想,但用于调试)。将下一个调用放入每个调用的成功回调中,看看它是否因为所有 ajax 调用都立即返回而受到猛烈抨击。它应该能够处理这个......不过还有更多......只是一个想法。

标签: javascript html angularjs performance asp.net-web-api


【解决方案1】:

我可以通过进入 IE 的 Internet 选项 > 浏览历史记录设置 > 磁盘空间来解决同样错误的问题。增加允许的磁盘空间,这可能会解决您的问题。

原来IE默认只允许浏览器使用250MB的磁盘空间。当然,这只是特定于一台机器的环境更改,但这在我的情况下有效(因为我们使用的数据 > 250 MB)

【讨论】:

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