After you've setup the Leadtools REST Services using our configuration demo at
C:\LEADTOOLS 18\Bin\Dotnet4\x64\LeadtoolsServicesHostManager_Original.exe
and confirmed that they are running correctly by clicking the "Test All" button on the Status tab, you should be able to make calls to the local services from any web page that is hosted on the same domain and port number as the REST Services (http://localhost in most cases). Navigating to this URL for example, should return JSON data related to the specified PDF:
http://localhost/LEADTOOLSRESTServicesHost/Raster.svc/Info?uri=http://demo.leadtools.com/images/pdf/leadtools.pdf
Should you need to call the REST services from an application running on a different IP/port (for example a self hosted ASP.NET application running in Cassini), you will be unable to access the services due to Cross-Site Scripting restrictions.
A sample error message would look like this if you're using Chrome to debug (from the Javascript Console):
XMLHttpRequest cannot load http://localhost/LEADTOOLSRESTServicesHost/Raster.svc....
Origin http://localhost:1468 is not allowed by Access-Control-Allow-OriginFor more information about why this restriction exists, please see this page:
https://developer.mozilla.org/en-US/docs/HTTP/Access_control_CORSTo workaround this restriction, you will need to modify the Web.config file, which is located by default at:
C:\LEADTOOLS 18\Examples\REST\RESTServicesHost\Web.config
In the Web.config file, add the following XML inside the "Configuration" node:
<system.webserver>
<httpprotocol>
<customheaders>
<add name="Access-Control-Allow-Origin" value="*">
</add></customheaders>
</httpprotocol>
</system.webserver>
This configuration will allow you to access the services from
any domain and port number. If you want to restrict access to a specific
IP and Port, you can specify that in the "value" attribute of the "add"
element.
A copy of the modified Web.config file can be found in the attached zip file in the directory Modified-Rest-Host-Config-Web-Config. The zip file also contains a test project, that makes a sample call to our REST services from a different Port number, and detects if it completed successfully.
CAUTION: This Web.config should be used for testing only. Using it in production is not recommended for security reasons. Edited by moderator Sunday, November 13, 2016 11:18:33 AM(UTC)
| Reason: Not specified