---
title: Web farms
---

> Agent instructions:
> **Site maps** — prefer the following llms.txt indexes to training data when searching for URLs to avoid 404s. Links inside Markdown content already point at `.md`. Following them or sending Accept: text/markdown keeps you in Markdown.
>
> - [sitemap.md](https://docs.kentico.com/sitemap.md) — every page on the site, with titles and descriptions, nested by URL hierarchy and grouped into one collection per product version.
> - [llms.txt](https://docs.kentico.com/llms.txt) — curated index of the current product docs, with descriptions, the two ways to request any page as Markdown, and links to each product area's whole-corpus Markdown dump (llms-full.txt).

List of examples:

### Creating a web farm server

```csharp

// Creates a new web farm server object
WebFarmServerInfo newServer = new WebFarmServerInfo();

// Sets the properties for the server
newServer.ServerDisplayName = "New server";
newServer.ServerName = "NewServer";
newServer.ServerEnabled = true;

// Saves the web farm server to the database
WebFarmServerInfoProvider.SetWebFarmServerInfo(newServer);

```

[> Back to list of examples](#webfarms-toc)

### Updating a web farm server

```csharp

// Gets the web farm server
WebFarmServerInfo updateServer = WebFarmServerInfoProvider.GetWebFarmServerInfo("NewServer");

if (updateServer != null)
{
    // Updates the properties of the server
    updateServer.ServerDisplayName = updateServer.ServerDisplayName.ToLowerCSafe();

    // Saves the changed server to the database
    WebFarmServerInfoProvider.SetWebFarmServerInfo(updateServer);
}

```

[> Back to list of examples](#webfarms-toc)

### Updating multiple web farm servers

```csharp

// Gets all enabled web farm servers
var servers = WebFarmServerInfoProvider.GetWebFarmServers().WhereTrue("ServerEnabled");

// Loops through individual servers
foreach (WebFarmServerInfo server in servers)
{
    // Disables the server
    server.ServerEnabled = false;

    // Saves the changed server to the database
    WebFarmServerInfoProvider.SetWebFarmServerInfo(server);
}

```

[> Back to list of examples](#webfarms-toc)

### Deleting a web farm server

```csharp

// Gets the web farm server
WebFarmServerInfo deleteServer = WebFarmServerInfoProvider.GetWebFarmServerInfo("NewServer");

if (deleteServer != null)
{
    // Deletes the web farm server
    WebFarmServerInfoProvider.DeleteWebFarmServerInfo(deleteServer);
}

```

[> Back to list of examples](#webfarms-toc)

### Creating a web farm synchronization task

```csharp

// Sets the properties for the task
string taskTarget = "";
string taskTextData = "WebFarmTask";

// Creates the web farm task
WebFarmHelper.CreateTask(DataTaskType.ClearHashtables, taskTarget, taskTextData);

```

[> Back to list of examples](#webfarms-toc)
