Jul 12, 2022
visibility 3929
star star star star star
(2 votes)

Local Multi-Site Setup for CMS12

Many solutions these days are Multi-Site enabled, with CMS 11 and using IIS it was simple to add multiple bindings to the same solution. With CMS12 when not using IIS it was not clearly documented on how to create multiple host names although it transpires this is very simple to achieve via the Program.cs class. 

To do this we can utilse the UseUrls extention on the WebHostBuilder and add the URLS as comma delimated parameters for the web host to listen on i.e. 

public class Program
{
    public static void Main(string[] args) => CreateHostBuilder(args).Build().Run();

    public static IHostBuilder CreateHostBuilder(string[] args) =>
        Host.CreateDefaultBuilder(args)
            .ConfigureCmsDefaults()
            .ConfigureWebHostDefaults(webBuilder => webBuilder.UseStartup<Startup>()
            .UseUrls("https://localhost:5001", "https://localhost:5002"));
}

Jul 12, 2022

Comments

Muhammad Kashif
Muhammad Kashif Jul 12, 2022 09:27 PM

Excellent piece of information thanks for sharing Minesh

error Please login to comment.
Latest blogs
How to Fetch CMP DAM Listing Cards in Optimizely CMS 12 Using GraphQL

Introduction In an existing Optimizely CMS 12 application, listing cards are typically populated using CMS content retrieved through the existing...

Deepmala S | Dec 3, 2026

Which environment am I in? Adding an environment badge to Optimizely CMS 13

Sometimes it’s hard to keep track of which environment you’re working in. Development, Integration, Preproduction and Production all look pretty mu...

Pär Wissmark | Dec 2, 2026 |

Hiring Your First AI Teammate: What Optimizely's Virtual Teammates Mean for the Marketing Org Chart

The coworker who never needs the brief twice How many times this week did you paste the same context into an AI tool? Brand voice, the target...

Leonardo Bravo | Dec 2, 2026

Upgrading to the new Optimizely brand UI: update CMS and Commerce Connect together

On October 27 , we released Optimizely CMS 13.5.0 with the new Optimizely brand UI: a new logo, colors, fonts and icons, and a redesigned login pag...

Bien Nguyen | Dec 1, 2026