Host LEADTOOLS services on IIS 5 and 6
The LEADTOOLS installation program will automatically configure your version of IIS to host the LEADTOOLS WCF Services. If you wish to host the LEADTOOLS WCF Services on another computer then you should follow these steps. Also, for more information about hosting WCF services, refer to: MSDN Hosting Services
When using LEADTOOLS WCF services, it is recommended to put the LEADTOOLS assemblies in the Global Assembly Cache for the following reasons:
- Loading assemblies from GAC mean less overhead and security since your application will always load the correct version of the .NET library.
- Performance gain - since the assemblies are already in the GAC, the verification and checking for integrity and code access of the LEADTOOLS assemblies will be skipped. This is especially true when your application is hosted in Windows Internet Information Services (IIS).
For more information, refer to the Global Assembly Cache topic in MSDN online here.
- Make sure IIS is installed and running on the machine. [ See details:MSDN Hosting Services , WebWizGuide - Installing IIS on Windows XP Pro ]
Tip: In Windows XP OS for example check to see if the IIS is providing services. Go to Internet Explorer and enter the local URL http://localhost/ to load a confirmation default page.
- Create a virtual directory and map the Services directory. Here are the steps:
Create a Host directory:
<LEADTOOLS_INSTALLDIR>\LEADTOOLS_WCF_HOST
Create a Bin directory:<LEADTOOLS_INSTALLDIR>\LEADTOOLS_WCF_HOST\Bin
Copy the Leadtools.Services.*
from<LEADTOOLS_INSTALLDIR>\Bin
to<LEADTOOLS_INSTALLDIR>\LEADTOOLS_WCF_HOST\Bin
Files to copy include:- Leadtools.Services.*.config files
- Redistributable files needed by the hosted service. For example: If you are hosting our IOcrService you need all redistributables for our OCR toolkit. Refer to Redistributables for more information on files installed by the LEADTOOLS setup.
- Create a
web.config
at<LEADTOOLS_INSTALLDIR>\LEADTOOLS_WCF_HOST
[ See details:MSDN - Configuring Services Using Configuration Files ] - Create a .svc file in
<LEADTOOLS_INSTALLDIR>\LEADTOOLS_WCF_HOST
[ See details:MSDN - Create an .svc File for the WCF Service ] - For example if you want to host the
IOcrService
, createOcrService.svc
file and add the following line to it (Add to this line the percent sign after < and before >):< @ServiceHost Language=C# Debug="true" Service="Leadtools.Services.Forms.ServiceImplementations.OcrService" >
- Go to Start > Control Panel > Administrative Tools > Internet Information Services (IIS) Manager [See details:MSDN - How to: Host a WCF Service in IIS ]
- Expand the following node: Internet Information Services > local computer > Web Sites > Default Web Site.
- Right click Default Web Site and select New > Virtual Directory to create a new virtual directory. Enter the following parameters:
Alias: LEADTOOLSWCFServices Directory: <LEADTOOLS_INSTALLDIR>\LEADTOOLS_WCF_HOST - Right-click on the LEADTOOLSWCFServices node you just created in the IIS manager. Go to Properties to view the resulting settings. The dialog will look like this:
Special notes for OCR service
Hosting our IOCRService requires the following:
- Engine type setting: Set the value for the EngineType in Leadtools.Services.Forms.ServiceImplementations.dll.config
- Modify the security for the ltthunkserver.exe:
- Go to Start > Run, type DCOMCNFG, and then click OK.
- Expand Component Services > Computers > My Computer > DCOM Config
- Scroll down and find ltthunkserver.
- Right-Click > Properties and select the Security tab.
- In Launch and Activation Permissions select customize radio button.
- Click Edit and Add the Service account with launch and activate permissions.
- If the engine type is professional and you are hosting IOcrService on IIS 5, you need to give the ASPNET user administrative privileges.
IIS Hosting Services Resources
MSDN - Configuring Services Using Configuration Files
MSDN - Create an .svc File for the WCF Service