raeldor
raeldor

Reputation: 483

Access Is Denied When Making XMLHttpRequest Call In Excel Add-In Javascript

I'm trying to pull data from a web service into Excel by creating an add-in. Pretty standard thing I thought. But I am getting Access is Denied on my call to...

        // make request
    var request = new XMLHttpRequest();
    request.onreadystatechange = function () {
        if (request.readyState === 4 && request.status === 200) {
            var factTable = JSON.parse(request.responseText);
        }
    }
    request.open("GET", "http://localhost:51805/Api/FactData?aaaViewName=aaa_telecom_services_forecast", false);

Specifically on the open line.

Why on earth would it block access? What can I do to get my data?

Thanks

Upvotes: 1

Views: 1445

Answers (1)

raeldor
raeldor

Reputation: 483

This seemed to be due to the fact that the office add-in was using https and the web service was using http. Even enabling CORS didn't help. I fixed by right clicking on the web service project and in the properties window (not project properties) setting 'SSL Enabled' to true and using the https version of the URL instead in the web service call.

Upvotes: 3

Related Questions