AnsweredAssumed Answered

PI Web API CORS request failed

Question asked by hzhao Employee on Apr 12, 2016
Latest reply on Apr 18, 2016 by dng



I'm trying the sample code of browsing AF elements here.


I ran the code on my own laptop while my Web API server (hzhao-piprimary) is on osisoft SCVMM, the same domain as my laptop.


My Web API settings are as follows:

but I kept getting the following error:


XMLHttpRequest cannot load https://hzhao-piprimary/piwebapi/assetservers. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:60318' is therefore not allowed access.


I've tried to use both Basic and Kerberos Authentication, but both of them will give me the above error.


Attached is my code, feel free to contact me if you need more information


Thank you very much!