LEADTOOLS WCF Send comments on this topic. | Back to Introduction - All Topics | Help Version 17.0.3.22
How to Host LEADTOOLS Services on IIS 7

Host LEADTOOLS services on IIS 7.* (Vista and Windows 7 OS)

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:

For more information, refer to the Global Assembly Cache topic in MSDN online here.

  1. Make sure IIS is installed and running on the machine. [See details:MSDN Hosting Services , WebWizGuide - Installing IIS on Windows XP Pro , IIS .Net - Installing IIS 7.* ]

    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.

  2. Create a virtual directory and map the Services directory. Here are the steps:
    Create a Host directory: C:\Program Files (x86)\LEAD Technologies\LEADTOOLS 17\LEADTOOLS_WCF_HOSTCreate a Bin directory: C:\Program Files (x86)\LEAD Technologies\LEADTOOLS 17\LEADTOOLS_WCF_HOST\BinCopy the Leadtools.Services.* from C:\Program Files (x86)\LEAD Technologies\LEADTOOLS 17\Bin to C:\Program Files (x86)\LEAD Technologies\LEADTOOLS 17\LEADTOOLS_WCF_HOST\Bin Files to copy include:
    1. Leadtools.Services.*.config files
    2. 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.
  3. Create a web.config at C:\Program Files (x86)\LEAD Technologies\LEADTOOLS 17\LEADTOOLS_WCF_HOST[See details: MSDN - Configuring Services Using Configuration Files ]
  4. If the user intends to upload files larger than 4 MB on Windows Vista or 7, there is a security restriction for IIS 7.*. To get around this restriction add the following in the Web.config:

                 <system.webServer>
                 <security>
                 <requestFiltering>
                 <requestLimits maxAllowedContentLength="2147483648"/> 
                 </requestFiltering>
                 </security>
                 </system.webServer>
                 
    

     

    Then in

    replace the following:

    <section name="requestFiltering" overrideModeDefault="Deny" />

    with

    <section name="requestFiltering" overrideModeDefault="Allow" />
  5. Create a .svc file in C:\Program Files (x86)\LEAD Technologies\LEADTOOLS 17\LEADTOOLS_WCF_HOST[ See details: MSDN - Create an .svc File for the WCF Service].
  6. For example if you want to host the IOcrService, create OcrService.svcfile 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" >
                 
    
  7. Go to Start > Control Panel > Administrative Tools > Internet Information Services (IIS) Manager [ See details: MSDN - How to: Host a WCF Service in IIS ].
  8. Expand the following node: Internet Information Services > local computer > Web Sites > Default Web Site.
  9. Right click Default Web Site and select Add Application to create a new virtual directory. Enter the following parameters:
    Alias: LEADTOOLSWCFServices
    Directory: C:\Program Files (x86)\LEAD Technologies\LEADTOOLS 17\LEADTOOLS_WCF_HOST
  10. The resulting Add Application dialog will look like this:

Special notes for OCR service

Hosting our IOCRService requires the following:

  1. Engine type setting: Set the value for the EngineType in Leadtools.Services.Forms.ServiceImplementations.dll.config
  2. Modify the security for the ltthunkserver.exe
  3. Go to Start > Run, type DCOMCNFG, and then click OK.
  4. Expand Component Services > Computers > My Computer > DCOM Config
  5. Scroll down and find ltthunkserver.
  6. Right-Click > Properties and select the Security tab.
    • In Launch and Activation Permissions select customize radio button.
    • Click Edit and Add the Service account (Network Service) with launch and activate permissions
  7. If the engine type is plus and you are hosting IOcrService on IIS7.*, you need to run the service under Local System identity.
  8. Go to Start > Control Panel > Administrative Tools > Internet Information Services (IIS) Manager.
  9. Expand the following node: Internet Information Services > local computer > Application Pools
  10. On the right pan right-click on DefaultAppPool and choose Advanced Settings as shown below:
  11. In the Advanced Settings dialog under Process Model group, change Identity from NetWorkService to LocalSystem.

IIS Hosting Services Resources

MSDN - Building Clients

MSDN - Data Contracts

MSDN - Service Contracts

MSDN - Configuring Services

MSDN - Hosting Services

MSDN - Configuring Services Using Configuration Files

MSDN - Create an .svc File for the WCF Service

MSDN - How to: Host a WCF Service in IIS

IIS .Net - Installing IIS 7.*

WebWizGuide - Installing IIS on Windows XP Pro