Products Technologies Demo Docs Blog Support Company

DS Server: Enabling HTTPS for TX Text Control Document Services Using Kestrel

In this article, we will explore how to enable HTTPS for TX Text Control Document Services (DS Server) using Kestrel, the cross-platform web server for ASP.NET Core. We will cover the necessary steps to configure Kestrel to serve DS Server securely over HTTPS.

DS Server: Enabling HTTPS for TX Text Control Document Services Using Kestrel

DS Server is a ready-to-use backend for document processing. It allows users to edit, view, merge, and create PDF and Word documents via API. The server supports .NET Core, Docker, and Linux environments and offers integrated OAuth security. It is designed for enterprise applications requiring robust document handling.

The service runs as an ASP.NET Core application and can be deployed on Windows or Linux servers. Many customers host it as part of their web infrastructure to enable browser-based document editing in enterprise applications. When running TX Text Control Document Services directly with the .NET runtime, the service is typically started like this:

dotnet TXTextControl.DocumentServices.dll

In this configuration, the application uses Kestrel, the built-in web server of ASP.NET Core, to run. To securely expose the service over the Internet or within a corporate network, enable HTTPS using a TLS certificate.

This article demonstrates two methods for configuring HTTPS for Document Services:

  • Configure the certificate directly in appsettings.json
  • Provide the certificate password securely using environment variables

Both approaches are compatible with the default ASP.NET Core configuration system.

Configuring HTTPS in appsettings.json

Kestrel endpoints can be defined in the application's configuration file. The following example shows how to configure an HTTPS endpoint on port 5001 using a PFX certificate:

{
  "Kestrel": {
    "Endpoints": {
      "Https": {
        "Url": "https://0.0.0.0:5001",
        "Certificate": {
          "Path": "certificate.pfx",
          "Password": "123"
        }
      }
    }
  }
}

The complete appsettings.json file would look like this:

{
        "Kestrel": {
        "Endpoints": {
                "Https": {
                        "Url": "https://0.0.0.0:5001",
                        "Certificate": {
                                "Path": "certificate.pfx",
                                "Password": "123"
                        }
                }
        }
  },
        "Logging": {
                "LogLevel": {
                        "Default": "Information",
                        "Microsoft": "Warning",
                        "Microsoft.Hosting.Lifetime": "Information",
                        "TXTextControl.DocumentServices": "Information"
                },
                "DSServerFile": {
                        "Options": {
                                "FolderPath": "./logs",
                                "FileName": "log_{dateTime}.log"
                        }
                }
        },
        "AllowedHosts": "*",
        "LiteDbOptions": {
                "DatabaseFileName": "Admin.db"
        }
}

With this configuration in place, starting the server automatically enables HTTPS:

dotnet TXTextControl.DocumentServices.dll

Kestrel loads the certificate from the specified PFX file and starts providing secure connections. This straightforward approach works well for local development or internal deployments.

Using Environment Variables for the Certificate Password

For production deployments, it is usually not recommended to store sensitive information, such as certificate passwords, directly in configuration files.

ASP.NET Core allows configuration values to be overridden using environment variables. These variables map to configuration keys using a double underscore (__) as a separator.

Therefore, remove the password from the configuration file and set it as an environment variable instead:

{
  "Kestrel": {
    "Endpoints": {
      "Https": {
        "Url": "https://0.0.0.0:5001",
        "Certificate": {
          "Path": "certificate.pfx"
        }
      }
    }
  }
}
Provide the Password via Environment Variable

Set the environment variable for the certificate password:

Windows (PowerShell):

$env:Kestrel__Endpoints__Https__Certificate__Password="yourpassword"
dotnet TXTextControl.DocumentServices.dll

Linux/macOS (Bash):

export Kestrel__Endpoints__Https__Certificate__Password="yourpassword"
dotnet TXTextControl.DocumentServices.dll

The configuration system resolves this variable to the internal configuration key:

Kestrel:Endpoints:Https:Certificate:Password

At runtime, the environment variable overrides the value in appsettings.json.

Recommended Deployment Structure

A common production layout involves separating configuration, certificates, and logs. For example:

/app
/app/appsettings.json
/app/certs/certificate.pfx
/app/logs

This structure allows certificates and secrets to be managed independently from the application binaries.

Conclusion

Using the ASP.NET Core configuration system, enabling HTTPS for TX Text Control Document Services with Kestrel is straightforward. Define the certificate in appsettings.json and securely provide the password via environment variables to ensure secure communication for your document processing service in production environments.

Stay in the loop!

Subscribe to the newsletter to receive the latest updates.

Related Posts

ASP.NET CoreConferenceDS Server

A Fantastic Week at VSLive! Orlando 2025

Recap of an exciting week at VSLive! Orlando 2025, featuring the latest in ASP.NET Core and DS Server technologies. Our team had the pleasure of meeting hundreds of developers, architects and…


ASP.NETASP.NET CoreDS Server

Extending DS Server with Custom Digital Signature APIs

In this article, we will explore how to extend the functionality of DS Server by integrating custom digital signature APIs. We will cover the necessary steps to create a plugin that allows DS…


ASP.NETASP.NET CoreConference

Meet Text Control at DDC 2025 in Cologne

Join us at the .NET Developer Conference (DDC) 2025 in Cologne from November 24-27. Visit our booth to explore the latest in document generation and reporting with Text Control's DS Server and…


ASP.NETASP.NET CoreDS Server

Building an Ecosystem around DS Server: Join Us as a Plug-in Pioneer

DS Server 4.1.0 introduces a plug-in architecture that transforms the platform into an extensible ecosystem. Text Control invites developers, ISVs, and domain experts to co-innovate, build the…


ASP.NET CoreDS ServerPlug-in

DS Server 4.1.0: Extend DS Server with Custom Plug-ins

With the release of DS Server 4.1.0, you can now extend DS Server with your own custom plug-ins to add new functionality or modify existing behavior. This article provides an overview of how to…

Share on this blog post on: