This tutorial shows how to configure and run the C# .NET 6 Document Service.
Overview | |
---|---|
Summary | This tutorial covers how to run the C# .NET 6 Document Service for Web Applications. |
Completion Time | 10 minutes |
Platform | C# .NET 6 Console Application |
IDE | Visual Studio 2022 |
Runtime Target | .NET 6 or higher |
Development License | Download LEADTOOLS |
Be sure to download and install the LEADTOOLS SDK, and make sure the license and key files are located in the <INSTALL_DIR>\LEADTOOLS23\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 6, 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 DocumentService.csproj
project in the <INSTALL_DIR>\LEADTOOLS23\Examples\Document\JS\DocumentServiceDotNet\net\
folder.
The project from the <INSTALL_DIR>\LEADTOOLS23\Examples\Document\JS\DocumentServiceDotNet\net\
folder is ready to run immediately. Doing so will launch the Document Service on the following url and port: http://localhost:30000
.
If the Document Service application has been moved outside of the above directory then specify the file path to the LEADTOOLS v23 license <INSTALL_DIR>\LEADTOOLS23\Support\Common\License
. To specify the file path, open the appsettings.json
file in the DocumentServiceDotNet\src\
folder.
On line 70, find the "lt.License.FilePath"
and enter the license file path.
"lt.License.FilePath": "C:\<INSTALL_DIR>\LEADTOOLS23\Support\Common\License\LEADTOOLS.lic"`
On line 75, find the "lt.License.DeveloperKey"
and enter the file path for the developer key.
"lt.License.DeveloperKey": "C:\<INSTALL_DIR>\LEADTOOLS23\Support\Common\License\LEADTOOLS.lic.key"
By default the .NET 6 Document Service will run on http://localhost:30000
. To change the port the service is running on, open the launchSettings.json
file in the DocumentServiceDotNet\net\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>"
}
}
}
Once the license is set and the settings are configured, build and run the project.
This tutorial showed how to configure and run the .NET 6 Document Service.