3

我创建了一个 SharePoint 托管应用程序,并且刚刚向该应用程序添加了许可证检查。通过使用 SP.WebProxy 调用 REST 端点来完成许可证检查。该应用程序被实现为一个应用程序部件,因此一个页面上可以有许多应用程序实例。

如果页面上只有一个或两个应用程序实例,则一切正常。但是,一旦我将第三个实例添加到页面,第三个实例就会开始未能通过许可证检查,并出现错误“此应用程序已达到其出站请求限制”。

显然,这是因为所有三个实例同时访问 SharePoint 代理服务。似乎允许特定应用程序同时调用的数量是有限制的。

问题是我找不到有关此限制的任何文档。我得到的错误在谷歌中没有得到一击。这是可以通过 web.config 中的设置增加的限制吗?

有人知道我可以查阅哪些文件吗?

4

1 回答 1

0

我已经使用下面的解决方法来绕过这个错误。(检查错误信息,然后使用“setTimeout”重新执行查询)

var response = SP.WebProxy.invoke(context, request);

    // Set the event handlers and invoke the request.
    context.executeQueryAsync(
        function () {
            if (response.get_statusCode() == 200) {
                var arrayResult = xmlToJson($.parseXML(response.get_body()));

                d.resolve(arrayResult);
            }
            else {
                var errorMessage = response.get_body();
                if (response.get_statusCode() == 403 && errorMessage == "This app has reached its outbound request limit.") {
                    //Try again in 100ms
                    setTimeout(function () {
                        console.log("reload");

                        response = SP.WebProxy.invoke(context, request);
                        context.executeQueryAsync(function () {
                            if (response.get_statusCode() == 200) {
                                var arrayResult = xmlToJson($.parseXML(response.get_body()));

                                d.resolve(arrayResult);
                            }
                        });
                    }, 100);
                }
                else {
                    d.reject(response.get_body());
                }
            }
        },
        function () { d.reject(response.get_body()); });

    return d.promise();
于 2016-11-01T17:44:15.940 回答