Skip to main content

The mysterious .dev.localhost checkbox

When you create a new ASP.NET Core project in Visual Studio, there's a checkbox that's easy to click past: "Use the .dev.localhost TLD in the application URL." I always want to understand what a checkbox actually does before I tick it, so let's dig into this one.

The problem it solves

When you're working on more than one local web project, they all end up living at the same address: localhost. Only the port number tells them apart. Open your browser's address bar with three projects running and you'll see localhost:5001, localhost:5215, localhost:7099 — and you have no idea which is which until you actually look at the page.

There's a second, less visible issue: because everything shares the localhost name, cookies and other domain-scoped browser storage are also shared across all your local apps. That's not something you usually want when you're testing.

What .dev.localhost actually is

.localhost is a reserved top-level domain, defined in RFC2606 and RFC6761 specifically for local testing. Modern browsers already resolve anything ending in .localhost straight to the loopback address (127.0.0.1/::1), so myapp.localhost behaves exactly like localhost without any hosts file editing or DNS setup.

Starting with .NET 10, ASP.NET Core builds on this and adds first-class support for a .dev.localhost subdomain. The project templates for ASP.NET Core Empty and Blazor Web App can combine your project name with that suffix, so instead of:

https://localhost:7099

you get:

https://myapp.dev.localhost:7099

That's the checkbox. It's also available from the CLI if you're not going through the Visual Studio wizard:

dotnet new web -n MyApp --localhost-tld

Remark: Kestrel is aware of .localhost addresses specifically. When your launch profile or ASPNETCORE_URLS points to a .dev.localhost name, Kestrel binds to the loopback address only (127.0.0.1/::1), not to all interfaces. It also logs both the .localhost and plain localhost addresses on startup, so you know both still work.

Why enable it

  • You can actually tell your apps apart. The project name is right there in the address bar instead of a port number you have to memorize.
  • Cookies and storage stop colliding. Because each app gets its own subdomain, browser storage that's scoped to the domain no longer bleeds between your local projects.
  • HTTPS still works out of the box. The ASP.NET Core dev certificate already lists *.dev.localhost as a Subject Alternative Name. You don't need to generate anything extra — dotnet dev-certs https already covers it. A wildcard cert for *.localhost itself isn't valid for a top-level domain, which is exactly why the .dev subdomain exists.
  • Nothing breaks. Kestrel keeps listening on plain localhost at the same time, so tools or scripts that still call localhost:7099 keep working.

The one gotcha: Safari

Safari on macOS doesn't resolve *.localhost names automatically. If you're testing in Safari, fall back to the plain localhost address — it's still there, side by side with the .dev.localhost one.

The same applies to non-browser clients. Some HTTP clients and tools resolve .localhost names through the normal DNS stack instead of special-casing them, and if your DNS doesn't know what to do with them, the request just fails. For those cases, keep using regular localhost.

That's it! A small checkbox, but now you know exactly why it's there — and when to leave it unchecked.

More information

Popular posts from this blog

Podman– Command execution failed with exit code 125

After updating WSL on one of the developer machines, Podman failed to work. When we took a look through Podman Desktop, we noticed that Podman had stopped running and returned the following error message: Error: Command execution failed with exit code 125 Here are the steps we tried to fix the issue: We started by running podman info to get some extra details on what could be wrong: >podman info OS: windows/amd64 provider: wsl version: 5.3.1 Cannot connect to Podman. Please verify your connection to the Linux system using `podman system connection list`, or try `podman machine init` and `podman machine start` to manage a new Linux VM Error: unable to connect to Podman socket: failed to connect: dial tcp 127.0.0.1:2655: connectex: No connection could be made because the target machine actively refused it. That makes sense as the podman VM was not running. Let’s check the VM: >podman machine list NAME         ...

Azure DevOps/ GitHub emoji

I’m really bad at remembering emoji’s. So here is cheat sheet with all emoji’s that can be used in tools that support the github emoji markdown markup: All credits go to rcaviers who created this list.

VS Code Planning mode

After the introduction of Plan mode in Visual Studio , it now also found its way into VS Code. Planning mode, or as I like to call it 'Hannibal mode', extends GitHub Copilot's Agent Mode capabilities to handle larger, multi-step coding tasks with a structured approach. Instead of jumping straight into code generation, Planning mode creates a detailed execution plan. If you want more details, have a look at my previous post . Putting plan mode into action VS Code takes a different approach compared to Visual Studio when using plan mode. Instead of a configuration setting that you can activate but have limited control over, planning is available as a separate chat mode/agent: I like this approach better than how Visual Studio does it as you have explicit control when plan mode is activated. Instead of immediately diving into execution, the plan agent creates a plan and asks some follow up questions: You can further edit the plan by clicking on ‘Open in Editor’: ...