Below are steps for how to set up our HTML5/Javascript OCR demo to use the ASP.NET MVC Web API as an external service on Local IIS. The same steps can be followed to set up any of our HTML5/Javascript demos (Annotations, BankCheckReader, Barcode, etc.).
1. Open Demos.sln in Visual Studio with Administrator privileges
2. Navigate to the project settings and to the Web tab.
3. Set the project to use Local IIS instead of IIS Express.
4. Click the button to Create Virtual Directory.
5. Now the Web API is set up on your Local IIS.
6. You can now take the OCR app out of the project directory and put it in your C:\inetpub\wwwroot directory.
7. Be sure to copy the OCR folder, Common folder, Resources folder, and the serviceConfig.json file.
8. I created another sub folder to keep the folder structure organized. Here is what my folder structure looks like:
C:\inetpub\wwwroot\BasicOcrDemo\Common
C:\inetpub\wwwroot\BasicOcrDemo\OCR
C:\inetpub\wwwroot\BasicOcrDemo\Resources
C:\inetpub\wwwroot\BasicOcrDemo\serviceConfig.json
9. By default IIS is not set up to load .json file so now you will need to set up IIS to load this MIME type.
10. Open the IIS Manager on your machine and navigate to the website which contains your project. By default it would be under "Default Web Site".
11. After clicking on the web site you should be able to double click the MIME Types icon under the IIS section.
12. Now you will want to click "Add..." under "Actions"
13. You will now want to add the json file information for loading the json file:
File name extension: .json
MIME type: application/json
14. You may now need to restart IIS.
15. Now your application should be able to successfully load the serviceConfig.json file to find the Web API.
16. Now we just need to alter the serviceConfig.json file to point to the current location of the Web API. Make sure to open the file in Visual Studio with admin privileges:
"serviceApiPath": "../../WebApp/api"
17. You should now be able to navigate to your application using localhost. It will look like this if you followed these instructions step by step.
http://localhost/BasicOcrDemo/Ocr/
Aaron Brasington
Developer Support Engineer
LEAD Technologies, Inc.