When using Episerver on-prem, a common architecture is a staging/live configuration. In this type of architecture, you will likely have three servers. One server behind a firewall with the Episerver editor enabled (the staging box) and two load-balanced public-facing boxes that anyone in the world can access to view the website (live). In the live boxes, it is common to disable the Episerver editor to ensure security.

This type of setup creates certain quirks. When a content editor updates a page on the editing server, how are those changes propagated to the live boxes? In today's guide, I'm going to explain how you can configure Episerver to work in this type of setup. I will cover all the config required to make this happen, as well as outline all the steps that you will need to follow. Sound good? Then read on!

What Is The Episerver Event Management System?

First off, let us discuss Episerver cache invalidation. Episerver uses something called the event management system to distribute events. You will need to use this to push content updates from staging to the live servers. The event management system is configured through your web.config. When it comes to setting up event management, you have two options of how the parent Episerver box talks to its children, UDP or TCP.

TCP or UDP?

For those of you who can't remember your network studies class during university days, UDP is a fire and forget protocol. Episerver will fire the cache invalidate command, however, when set to UDP mode it is not guaranteed that the request will make it to a child infrastructure node. UDP is a 'cheaper' option for sending events.

In the older versions of Episerver (7 and below) a missed UDP call resulted in a full-cache invalidation, however, this is no longer the case. I've used both UDP and TCP in production and they both seem to work. I have encountered a locked port issue when setting up a continuous deployment pipeline using TCP. When the app pool recycled in the production box the port locked. This prevented incoming requests from being processed until an IISRESET was performed. UDP might be the better route to try first. If you're not happy with it, you can always change it later as the update process is fairly painless.

Configuration Time

Cache invalidation should just magically work when you enable the events management. Within the projects web.config, you'll need to add some config like this:

This configuration is using UDP to push changes between servers. In the client section, this is where you add your Editor server URL. The config to register the production web servers using their IP addresses is seen on Line15 and 16. When configuring these URLs, I suggest you log into the box and try the URLs manually within a browser to make sure that the servers can talk to each other before adding Episerver into the mix. This will make debugging less painful

If you wanted to use TCP, you would need to change the soap.udp:// protocols to net.tcp:// instead as well as change the binding types, from customBinding to netTcpBindin. For more information about this, you can see some further examples from the Episerver website, here. This should hopefully be all you need to enable a staging/live server configuration. Happy Coding 🤘