Configure and Run the Document Service - .NET Framework

This tutorial shows how to configure and run the .NET Framework Document Service.

Overview  
Summary This tutorial covers how to run the .NET Framework Document Service for Web Applications.
Completion Time 10 minutes
Platform .NET Framework Application
IDE Visual Studio 2017, 2019
Development License Download LEADTOOLS
Try it in another language

Required Knowledge

Be sure to download and install the LEADTOOLS SDK, and make sure the license and key files are located in the <INSTALL_DIR>\LEADTOOLS21\Support\Common\License directory. To set the license, refer to the Add References and Set a License tutorial.

The installed LEADTOOLS SDK contains the LEADTOOLS Document Service projects. The .NET Framework, .NET Core, and Java Document Service projects offer the ability to communicate to a server to make .NET calls when running an HTML5/JS application. The Document Service projects are set up to run alongside many of our HTML5/JS Demos out of box (i.e. DocumentViewerDemo).

Open the Document Service Project

Open DocumentService.csproj or DocumentService_Nuget.csproj.

Opening the project from the <INSTALL_DIR>\LEADTOOLS21\Examples\JS\Services\DocumentServiceDotNet\fx\ folder is ready to run immediately. Doing so will launch the Document Service on the following url and port: http://localhost:40000.

Specify the License File Path

If the Document Service application has been moved outside of the above directory, then specify the file path to the LEADTOOLS v21 license <INSTALL_DIR>\LEADTOOLS21\Support\Common\License. To specify the file path open the appsettings.json file in the DocumentServiceDotNet\src\ folder.

On line 58 find the "lt.License.FilePath" and enter the in the license file path.

"lt.License.FilePath": "C:\path\LEADTOOLS.lic"` 

On line 63 find the "lt.License.DeveloperKey" and enter the file path for the developer key.

"lt.License.DeveloperKey": "C:\path\LEADTOOLS.lic.key" 

Change the Ports

By default the Document Service will run on http://localhost:40000. To change the port the service is running on, open the launchSettings.json file in the DocumentServiceDotNet\fx\Properties\ folder. Four lines need to be changed in order for the service to run on a different port. Find "applicationUrl" on lines 6 and 28, and find "launchUrl" on lines 14 and 23. Then change their corresponding values to the desired url and port number. The launchSettings.json should look as follows:

{ 
  "iisSettings": { 
    "windowsAuthentication": false, 
    "anonymousAuthentication": true, 
    "iisExpress": { 
      "applicationUrl": "<New URL here>", 
      "sslPort": 0 
    } 
  }, 
  "profiles": { 
    "IIS Express": { 
      "commandName": "IISExpress", 
      "launchBrowser": true, 
      "launchUrl": "<New URL here>/index.html", 
      "environmentVariables": { 
        "ASPNETCORE_preventHostingStartup": "False", 
        "ASPNETCORE_ENVIRONMENT": "Development" 
      } 
    }, 
    "DocumentServiceCore": { 
      "commandName": "Project", 
      "launchBrowser": true, 
      "launchUrl": "<New URL here>/index.html", 
      "environmentVariables": { 
        "ASPNETCORE_preventHostingStartup": "False", 
        "ASPNETCORE_ENVIRONMENT": "Development" 
      }, 
      "applicationUrl": "<New URL here>" 
    } 
  } 
} 

Run the Project

Once the license is set and the settings are configured, build and run the project.

Successful connection to Document Service

Wrap-up

This tutorial showed how to configure and run the .NET Framework Document Service.

See Also

Help Version 21.0.2023.3.1
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.