---
title: Set up local hosting
---

> 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).

When developing websites, you often need to quickly build and test code changes made to the project. For this reason, it's useful to have the site hosted locally on your development machine. ASP.NET Core is very flexible in this aspect as it offers multiple hosting options for its supported platforms.

See the following sections for a breakdown of hosting options available on each platform supported by Xperience:

- [Windows platforms](#windows-platforms)
- [Linux distributions](#linux-distributions)

## Windows platforms

### Kestrel

The [Kestrel](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/servers/kestrel) web server is the **recommended** hosting option. It is cross-platform, usually offers better performance, and will have the strongest .NET support in the future.

You can launch all projects locally via the `dotnet run` command:

```cmd
cd <project_directory>
dotnet run
```

This launches the application on _localhost_ using an empty port randomly assigned during the [installation process](https://docs.kentico.com/documentation/developers-and-admins/installation.md). You can change the assigned defaults via the project's [launchSettings.json file](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/environments#development-and-launchsettingsjson).

### IIS Express

[IIS Express](https://docs.microsoft.com/en-us/iis/extensions/introduction-to-iis-express/iis-express-overview) is a lightweight, self-contained version of IIS optimized for developers. IIS Express makes it easy to use the most current version of IIS to develop and test websites. It has all the core capabilities of IIS 7 and above as well as additional features designed to ease website development including:

- It doesn't run as a service or require administrator user rights to perform most tasks.
- IIS Express works well with ASP.NET Core and PHP applications.
- Multiple users of IIS Express can work independently on the same computer.

To host the installed project using IIS Express:

1. Open the installed project in Visual Studio.
2. Right-click the project file and select **Properties**.
3. Under Debug:
   - Set **Launch** to **IIS Express**.

     ![Configure IIS hosting for the application](https://docs.kentico.com/docsassets/documentation/set-up-local-hosting/CoreProjectHostingConfiguration.png "Configure IIS hosting for the application")
4. Save the changes and run the project using the profile you configured (**IIS Express** in this example).

> **Tip:** Alternatively, you can use the project's [launchSettings.json](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/environments#development-and-launchsettingsjson) file to configure launch profiles.

You can now launch the project using IIS Express.

### IIS

ASP.NET Core also supports hosting using [Internet Information Services](https://www.iis.net/) (IIS). You can host applications either _in-process_ (through the **wpw3.exe** worker) or _out-of-process_ (using reverse proxy with Kestrel).

See the official Microsoft documentation [Host ASP.NET Core on Windows with IIS](https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/) for the required configuration and set up. Make sure that you have [ASP.NET Core 6.0 Runtime - Windows Hosting Bundle](https://dotnet.microsoft.com/permalink/dotnetcore-current-windows-runtime-bundle-installer) installed.

## Linux distributions

### Kestrel

The [Kestrel](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/servers/kestrel) web server is supported by default by all ASP.NET Core web applications.

You can launch all projects locally via the `dotnet run` command:

```bash
$ cd <project_directory>
$ dotnet run
```

Which launches the application on _localhost_ using an empty port randomly assigned during the [installation process](https://docs.kentico.com/documentation/developers-and-admins/installation.md).

### Ngnix and Apache

ASP.NET Core also supports hosting using [Apache](https://httpd.apache.org/) and [Nginx](https://www.nginx.com/).

See the official Microsoft documentation for

- [Apache](https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/linux-apache)
- [Nginx](https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/linux-nginx)

to learn how to configure hosting using these services.

## Hosting configuration notes

### Enable static web assets in non-Development local environments

The Xperience application must have static web assets enabled to correctly load script files and other resources. When running Xperience locally (e.g., using the built-in Visual Studio IIS Express server), static web assets are enabled by default in the [Development](https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.hosting.environments.development) environment. However, if you are using a different environment, e.g., by setting ASPNETCORE\_ENVIRONMENT to a different value in the _Properties/launchSettings.json_ file, you need to enable static web assets – call [UseStaticWebAssets](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.hosting.webhostbuilderextensions.usestaticwebassets) on [WebApplicationBuilder](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.builder.webapplicationbuilder) in _Program.cs_.

```csharp title="Program.cs"
using Kentico.Web.Mvc;

var builder = WebApplication.CreateBuilder(args);  

...

builder.Services.AddKentico(features =>
{
    ...
});

...

// Enables static web assets
builder.WebHost.UseStaticWebAssets();
```
