-
Notifications
You must be signed in to change notification settings - Fork 24
Getting started
Mariusz Kerl edited this page Aug 26, 2020
·
3 revisions
Our example will be created in .NET Core 2.0 but that will look same for .NET Framework projects.
Before we will define first subdomain route, let's tell our application that we are using subdomain routes by invoking AddSubdomains() method (what it really does is injection of our SubdomainUrlHelperFactory). Don't forget about it if you don't want to have bad time.
public void ConfigureServices(IServiceCollection services)
{
services.AddSubdomains();
services.AddMvc(x => x.EnableEndpointRouting = false);
}Use it before AddMvc(). You should not have to add any new using statements but if method is not found make sure you have installed library correctly. Method lives in Microsoft.Extensions.DependencyInjection namespace. I know it may be against current religion of extending frameworks, but that's how it's made now.