3

I've created a SharePoint hosted app and have just added a license check to the app. The license check is done by making a call to a REST endpoint using SP.WebProxy. The app is implemented as an App Part, and as such there can be many instances of the app on a page.

Everything works fine if there is only one or two instances of the app on the page. As soon as I add a third instance to the page however, the third instance starts failing the license check with the error "This app has reached its outbound request limit."

Obviously this is happening because all three instances are hitting the SharePoint Proxy service at the same time. It would appear as though there is a limit to the number of simultaneous calls that a particular app is allowed to make.

The problem is that I can't find any documentation regarding this limit. The error that I'm getting does not get a single hit in Google. Is this a limit that can be increased with a setting in web.config?

Does anybody know what documentation I can consult regarding this?

  • Also stumbled into that issue and can not find documentation or any posts that can help with it. I am wondering if it is possible to change the limit or queuing the calls is the only solution. Have you found any solution? – MikhailSP Feb 20 '15 at 08:02
  • Does anybody have any news? – MikhailSP Jun 29 '15 at 09:37

1 Answers1

0

I've used below work-around to by pass this error. (Checking the error message then re-execute the query using "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();
Moe
  • 1,599
  • 11
  • 16