Managing web farm servers

  Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic! Mail us feedback on this topic!  

The following sample code shows how you can create a new web farm server and add it to the system:

 

[C#]

 

using CMS.WebFarmSync;

 

...

     

        // Create new web farm server object

        WebFarmServerInfo wfsi = new WebFarmServerInfo();

 

        // Set properties

        wfsi.ServerDisplayName = "Test server";

        wfsi.ServerName = "TestServer";

        wfsi.ServerEnabled = true;

        wfsi.ServerURL = "http://localhost/KenticoCMS";

 

        // Save to database

        WebFarmServerInfoProvider.SetWebFarmServerInfo(wfsi);

 

The following sample code shows how you can modify the display name of an existing web farm server:

 

[C#]

 

using CMS.WebFarmSync;

 

...

 

        // Get web farm server

        WebFarmServerInfo wfsi = WebFarmServerInfoProvider.GetWebFarmServerInfo("TestServer");

 

        // If server exists

        if (wfsi != null)

        {

            // Update property

            wfsi.ServerDisplayName += " updated";

 

            // Save to database

            WebFarmServerInfoProvider.SetWebFarmServerInfo(wfsi);

        }

 

The following sample code shows how you can delete an existing web farm server:

 

[C#]

 

using CMS.WebFarmSync;

 

...

 

        // Get web farm server

        WebFarmServerInfo wfsi = WebFarmServerInfoProvider.GetWebFarmServerInfo("TestServer");

 

        // If server exists

        if (wfsi != null)

        {

            // Remove from database

            WebFarmServerInfoProvider.DeleteWebFarmServerInfo(wfsi.ServerID);

        }

 

Page url: http://devnet.kentico.com/docs/5_5r2/devguide/index.html?api_managing_web_farm_servers.htm