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) =>
WebHost.CreateDefaultBuilder(args)
.UseModularStartup<Startup>()
.Build();
vs
var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseModularStartup<Startup>()
.UseUrls(Environment.GetEnvironmentVariable("ASPNETCORE_URLS") ?? "http://localhost:5000/")
.Build();
host.Run();
I see in the Microsoft docs that “CreateDefaultBuilder()” method initializes the appsettings.json file. Howe can this be done with the selfhost option?