# ASP.NET Core: Deploying the TX Text Control Document Editor to Linux

> In order to deploy the TX Text Control document editor to Linux as part of an ASP.NET Core (.NET 5) Web Application, the synchronization service must be deployed separately to a Windows VM. This way, the web application itself can be deployed to Azure App Services or other container based deployment services.

> **Note:** This article is outdated and may no longer be accurate.

- **Author:** Bjoern Meyer
- **Published:** 2021-10-29
- **Modified:** 2026-07-17
- **Description:** In order to deploy the TX Text Control document editor to Linux as part of an ASP.NET Core (.NET 5) Web Application, the synchronization service must be deployed separately to a Windows VM. This way, the web application itself can be deployed to Azure App Services or other container based deployment services.
- **7 min read** (1229 words)
- **Tags:**
  - ASP.NET
  - Docker
  - Linux
  - .NET Core
- **Web URL:** https://www.textcontrol.com/blog/2021/10/29/deploying-tx-text-control-to-linux/
- **LLMs URL:** https://www.textcontrol.com/blog/2021/10/29/deploying-tx-text-control-to-linux/llms.txt
- **LLMs-Full URL:** https://www.textcontrol.com/blog/2021/10/29/deploying-tx-text-control-to-linux/llms-full.txt

---

When integrating the TX Text Control ASP.NET document editor into an ASP.NET Core Web Application, the editor requires two parts:

- **NuGet package**The ASP.NET MVC NuGet package for the client-side components
- **Backend: Synchronization service**Server-side backend synchronization service running TX Text Control

In order to deploy the TX Text Control document editor to Linux as part of an ASP.NET Core (.NET 5) Web Application, the synchronization service must be deployed separately to a Windows VM. This way, the web application itself can be deployed to Azure App Services or other container based deployment services.

This article shows how to create an ASP.NET Core Web Application running on a Linux container and how to connect it to the synchronization service that is deployed on a different, separate server. The following diagram shows a simplified version of such a deployment without any load balancing:

![Deploy to App Services](https://s1-www.textcontrol.com/assets/dist/blog/2021/10/29/a/assets/azure_diagram.webp "Deploy to App Services")

### Creating the ASP.NET Web Application

In a first step, the ASP.NET Web Application is created. As a requirement for this tutorial, at least Visual Studio 2019 (version 16.9.1), [Docker](https://www.docker.com/) (Linux containers active) and [.NET 5](https://dotnet.microsoft.com/download/dotnet/5.0) must be installed.

1. **Create an ASP.NET Core Web Application**In Visual Studio, create a new *ASP.NET Core Web Application*.
    
    ![Deploy to App Services](https://s1-www.textcontrol.com/assets/dist/blog/2021/10/29/a/assets/step1.webp "Deploy to App Services")
2. Specify a name for the project and continue with *Next*.
3. Select *.NET 5* as the *Target Framework*, check *Configure for HTTPS* and *Enable Docker*. Select *Linux* as the *Docker OS*. Confirm with *Create*.
    
    ![Deploy to App Services](https://s1-www.textcontrol.com/assets/dist/blog/2021/10/29/a/assets/step2.webp "Deploy to App Services")
4. **Adding Text Control NuGet**Open the *Package Manager Console* from the *Tools -> NuGet Package Manager* menu. In the *Package Manager Console*, type in the following command:
    
    ```
    PM> Install-Package TXTextControl.Web
    ```
5. In the *Solution Explorer*, find the *Views -> Home -> Index.cshtml* view and open it. Replace the content with the following code:
    
    ```
    @using TXTextControl.Web.MVC 
    
    @Html.TXTextControl().TextControl().Render()
    ```
6. In the *Solution Explorer*, select the project and create a new class by choosing *Add Class...* from the *Project* main menu. Name the class *CustomWebSocketMiddleware.cs* and confirm with *Add*. Add the following code to the newly created class:
    
    ```
    using Microsoft.AspNetCore.Http;
    using System;
    using System.Linq;
    using System.Net;
    using System.Threading.Tasks;
    using TXTextControl.Web;
    
    public class CustomWebSocketMiddleware {
    	private RequestDelegate m_next;
    	private IPAddress m_serviceAddress;
    	private int m_servicePort;
    
    	internal static readonly byte[] DefaultServiceAddress = { 127, 0, 0, 1 };
    	internal const int DefaultServicePort = 4279;
    
    	public CustomWebSocketMiddleware(RequestDelegate next) {
    		m_next = next;
    		m_serviceAddress = new IPAddress(DefaultServiceAddress);
    		m_servicePort = DefaultServicePort;
    	}
    
    	public CustomWebSocketMiddleware(RequestDelegate next,
    					 IPAddress serviceAddress,
    					 int servicePort = DefaultServicePort) {
    		m_next = next;
    		m_serviceAddress = serviceAddress;
    		m_servicePort = servicePort;
    	}
    
    	public CustomWebSocketMiddleware(RequestDelegate next,
    					 string hostNameOrAddress,
    					 int servicePort = DefaultServicePort) {
    		m_next = next;
    		IPAddress addr = Dns.GetHostAddresses(hostNameOrAddress).FirstOrDefault();
    		if (addr == null) throw new Exception($"Host '{hostNameOrAddress}' not found.");
    		m_serviceAddress = addr;
    		m_servicePort = servicePort;
    	}
    
    	public async Task Invoke(HttpContext context) {
    		if (context.WebSockets.IsWebSocketRequest &&
    		  context.WebSockets.WebSocketRequestedProtocols.Contains("TXTextControl.Web")) {
    			var ws = new WebSocketHandler(m_serviceAddress, m_servicePort);
    			await ws.Invoke(context);
    		}
    		else if (m_next != null) {
    			await m_next.Invoke(context);
    		}
    	}
    }
    ```
7. Open the Startup.cs file located in the project's root folder. In the Configure method, add the following code to the end of the method:
    
    ```
    // serve static linked files (JavaScript and CSS for the editor)
    app.UseStaticFiles(new StaticFileOptions
    {
        FileProvider = new Microsoft.Extensions.FileProviders.PhysicalFileProvider(
           System.IO.Path.Combine(System.IO.Path.GetDirectoryName(
               System.Reflection.Assembly.GetEntryAssembly().Location),
               "TXTextControl.Web")),
        RequestPath = "/TXTextControl.Web"
    });
    
    // enable Web Sockets
    app.UseWebSockets();
    
    // attach the Text Control custom WebSocketHandler middleware
    app.UseMiddleware<CustomWebSocketMiddleware>("127.0.0.1", 4279);
    ```
    
    > **Important**
    > 
    > The parameters given in the constructor define the IP address and port of your hosted synchronization service. Replace the first parameter (*"127.0.0.1"*) with your IP.
    > 
    > The second parameter is the port number of the synchronization TCP service. This is a fixed number for each version and increases with each major release:
    > 
    > 
    > - Version 28.0: **4277**
    > - Version 29.0: **4278**
    > - Version 30.0: **4279**
    > - Version 31.0: **4280**

### Hosting the Synchronization Service

In order to deploy the synchronization service, a full Windows Server or VM is required as the TCP service runs as a Windows Service. Assuming that you already have a Windows Server available or created a VM in your preferred cloud provider such as Microsoft Azure, follow these steps to deploy the service.

1. On your development machine (where you installed the developer setup of TX Text Control), create a folder and copy all files from the following folders into the same folder.
    
    > **Pro Tip**
    > 
    > Name the folder including the TX Text Control version number. For example: *TX Synchronization Service 29.0 SP3*.
    
    
    - *C:\\Program Files\\Text Control GmbH\\TX Text Control 29.0.NET Server for ASP.NET\\Assembly*
    - *C:\\Program Files\\Text Control GmbH\\TX Text Control 29.0.NET Server for ASP.NET\\Assembly\\bin64*
    - *C:\\Program Files\\Text Control GmbH\\TX Text Control 29.0.NET Server for ASP.NET\\Tools*
    
    Your folder now should contain these files:
    
    ![Deploy to App Services](https://s1-www.textcontrol.com/assets/dist/blog/2021/10/29/a/assets/step3.webp "Deploy to App Services")
2. Copy this folder to any location on the dedicated Windows Server or your VM.
3. On that server, open a command prompt with administrator rights and change the directory to the copied folder that contains the TX Text Control service files. Type in and execute the following command:
    
    ```
    txregwebsvr.exe /i
    ```

### Adjusting Firewalls

The ASP.NET Core Web Application communicates with the previously installed service using pure TCP on the given port number. TCP traffic must be allowed on this specific port.

1. On your server that hosts the synchronization service, open a command prompt window and type:
    
    ```
    wf.msc
    ```
2. From the left-hand tree view, select *Inbound Rules* and create a new rule by clicking *New Rule...*.
3. In the opened dialog, select *Port* and confirm with *Next >*.
    
    ![Deploy to App Services](https://s1-www.textcontrol.com/assets/dist/blog/2021/10/29/a/assets/step4.webp "Deploy to App Services")
4. Select *TCP* and specify the port number and confirm with *Next >*.
    
    ![Deploy to App Services](https://s1-www.textcontrol.com/assets/dist/blog/2021/10/29/a/assets/step5.webp "Deploy to App Services")
5. Select *Allow* and confirm with *Next >*.
    
    ![Deploy to App Services](https://s1-www.textcontrol.com/assets/dist/blog/2021/10/29/a/assets/step6.webp "Deploy to App Services")
6. Select the preferred network areas (*Domain*, *Private* and *Public*).
7. Name the rule *TX Service 29.0* and click *Finish*.

In case you are using Azure or another cloud service, you might have to open this port for the VM as well. For Azure, follow the next steps.

1. In your *Network security group*, select *Inbound security rules*. Then select *+ Add* to add a new rule.
2. Set the *Destination port ranges* to **4279**, *Protocol* to **TCP** and *Action* to **Allow**. Confirm with *Add*.
    
    ![Deploy to App Services](https://s1-www.textcontrol.com/assets/dist/blog/2021/10/29/a/assets/step7.webp "Deploy to App Services")

Now is a good time to verify the IP address in step 7 of *Creating the ASP.NET Web Application*. Make sure to add the IP address of your Vm that hosts the synchronization service.

After these steps, you successfully deployed TX Text Control to Linux with a separate synchronization service running on a Windows Server VM.

---

## About Bjoern Meyer

As CEO, Bjoern is the visionary behind our strategic direction and business development, bridging the gap between our customers and engineering teams. His deep passion for coding and web technologies drives the creation of innovative products. If you're at a tech conference, be sure to stop by our booth - you'll most likely meet Bjoern in person. With an advanced graduate degree (Dipl. Inf.) in Computer Science, specializing in AI, from the University of Bremen, Bjoern brings significant expertise to his role. In his spare time, Bjoern enjoys running, paragliding, mountain biking, and playing the piano.

- [LinkedIn](https://www.linkedin.com/in/bjoernmeyer/)
- [X](https://x.com/txbjoern)
- [GitHub](https://github.com/bjoerntx)

---

## Related Posts

- [ASP.NET Core: Deploying the TX Text Control 32.0 SP2 Document Editor to Linux](https://www.textcontrol.com/blog/2024/01/22/deploying-tx-text-control-to-linux/llms.txt)
- [Announcing the Official DS Server Docker Image on Docker Hub](https://www.textcontrol.com/blog/2025/05/02/announcing-the-official-ds-server-docker-image-on-docker-hub/llms.txt)
- [Using TX Text Control with Ultra-Minimal Chiseled Linux Containers](https://www.textcontrol.com/blog/2025/03/12/using-tx-text-control-with-ultra-minimal-chiseled-linux-containers/llms.txt)
- [Getting Started: ServerTextControl and MailMerge in a .NET 8 Console Application on Linux with Docker and WSL](https://www.textcontrol.com/blog/2025/03/12/getting-started-servertextcontrol-and-mailmerge-in-a-net-8-console-application-on-linux-with-docker-and-wsl/llms.txt)
- [Getting Started: Document Editor with ASP.NET Core and Docker Support with Linux Containers](https://www.textcontrol.com/blog/2025/03/12/getting-started-document-editor-with-asp-net-core-and-docker-support-with-linux-containers/llms.txt)
- [ASP.NET Core: Deploying the TX Text Control Document Viewer to Azure App Services](https://www.textcontrol.com/blog/2022/11/29/deploying-document-viewer-to-linux/llms.txt)
- [ASP.NET Core: Deploying the TX Text Control Document Viewer to Azure App Services](https://www.textcontrol.com/blog/2021/11/08/deploying-document-viewer-to-linux/llms.txt)
- [Document Editor with TX Spell .NET on Linux using ASP.NET Core](https://www.textcontrol.com/blog/2026/01/28/document-editor-tx-spell-net-linux-aspnet-core/llms.txt)
- [Convert MS Word DOCX to PDF including Text Reflow using .NET C# on Linux](https://www.textcontrol.com/blog/2025/06/10/convert-ms-word-docx-to-pdf-including-text-reflow-using-dotnet-csharp-on-linux/llms.txt)
- [Introducing DS Server 4.0: Linux-Ready and Container-Friendly](https://www.textcontrol.com/blog/2025/04/30/introducing-ds-server-4-linux-ready-and-container-friendly/llms.txt)
- [Using a Private NuGet Feed to Build and Restore .NET Apps for Docker Deployment](https://www.textcontrol.com/blog/2025/04/11/using-a-private-nuget-feed-to-build-and-restore-dotnet-apps-for-docker-deployment/llms.txt)
- [Deploying the TX Text Control Document Editor Backend Web Server in Docker](https://www.textcontrol.com/blog/2025/04/10/deploying-the-tx-text-control-document-editor-backend-web-server-in-docker/llms.txt)
- [Creating a .NET Console Application with Visual Studio Code and TX Text Control (on Linux)](https://www.textcontrol.com/blog/2025/04/03/creating-a-dotnet-console-application-with-visual-studio-code-and-tx-text-control-on-linux/llms.txt)
- [TX Text Control Core vs. Classic Performance Comparison Plain Text to DOCX and PDF](https://www.textcontrol.com/blog/2025/03/31/2025-03-31-tx-text-control-core-vs-classic-performance-comparison-plain-text-to-docx-and-pdf/llms.txt)
- [How to Create PDF Documents with TX Text Control using C# .NET on Linux](https://www.textcontrol.com/blog/2025/03/18/how-to-create-pdf-documents-with-tx-text-control-using-c-sharp-net-on-linux/llms.txt)
- [Benchmarking TX Text Control: Classic vs. Core on Windows and Linux](https://www.textcontrol.com/blog/2025/03/14/benchmarking-tx-text-control-classic-vs-core-on-windows-and-linux/llms.txt)
- [Introducing TXTextControl.Web.Server.Core: A Cross-Platform Backend for TX Text Control Document Editor](https://www.textcontrol.com/blog/2025/03/13/introducing-txtextcontrol-web-server-core-a-cross-platform-backend-for-tx-text-control-document-editor/llms.txt)
- [Version 33.0 Preview: NuGet Packages Explained and Why we Minimize Dependencies](https://www.textcontrol.com/blog/2025/02/24/version-33-0-preview-nuget-packages-explained-and-why-we-minimize-dependencies/llms.txt)
- [Why an Unlimited Runtime License (OEM) for TX Text Control is Perfect for Cloud Deployments](https://www.textcontrol.com/blog/2025/01/08/why-an-unlimited-runtime-license-oem-for-tx-text-control-is-perfect-for-cloud-deployments/llms.txt)
- [TX Text Control Linux Preview: Font Handling](https://www.textcontrol.com/blog/2024/12/28/tx-text-control-linux-preview-font-handling/llms.txt)
- [Celebrating a Successful 2024: Key Achievements and Exciting Outlook for 2025](https://www.textcontrol.com/blog/2024/12/17/celebrating-a-successful-2024-key-achievements-and-exciting-outlook-for-2025/llms.txt)
- [TX Text Control for Linux Preview: Document Processing in ASP.NET Core on Azure App Services](https://www.textcontrol.com/blog/2024/12/17/tx-text-control-for-linux-preview-document-processing-in-asp-net-core-on-azure-app-services/llms.txt)
- [Hello Linux! Almost There - A Game-Changer for Document Processing](https://www.textcontrol.com/blog/2024/12/12/hello-linux-almost-there-a-game-changer-for-document-processing/llms.txt)
- [Creating an ASP.NET Core Web App with Docker Support and GitHub Packages](https://www.textcontrol.com/blog/2024/01/05/creating-an-asp-net-core-web-app-with-docker-support-and-github-packages/llms.txt)
- [Deploying an ASP.NET Core Web App to Azure App Services](https://www.textcontrol.com/blog/2023/09/23/deploying-an-aspnet-core-web-app-to-azure-app-services/llms.txt)
