Unable to register appsettings.json with x new selfhost project

This doesn’t work with the selfhost project type

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
    //Register your ServiceStack AppHost as a .NET Core module
    app.UseServiceStack(new AppHost { 
        // Use ASP.NET Core configuration sources, e.g. **appsettings.json**
        AppSettings = new NetCoreAppSettings(Configuration) 

Getting a ServiceStack license exception despite having the appropriate value in appsettings.json

It seems the problem may be due to the fact that x new selfhost uses a different project “scheme” than x new web

    public static IWebHost BuildWebHost(string[] args) =>


        var host = new WebHostBuilder()
            .UseUrls(Environment.GetEnvironmentVariable("ASPNETCORE_URLS") ?? "http://localhost:5000/")


I see in the Microsoft docs that “CreateDefaultBuilder()” method initializes the appsettings.json file. Howe can this be done with the selfhost option?


I fixed the problem by changing the selhost startup to use the same startup as web. Not sure why there was a different scheme. Hope nothing breaks as a result of this, but so far so good.