Can't get license to work from appsettings.json

Despite following information found here regarding this, I can’t seem to get Servicestack to recognize the license key from appsettings.json.

I’m using latest 5.5 version of Servicestack.

Appsettings.json looks like this:

  "Logging": {
    "LogLevel": {
      "Default": "Warning"
  "servicestack": {
    "license": "<licensekey>"
  "AllowedHosts": "*"

Startup.cs looks like this:

    app.UseServiceStack(new AppHost
            AppSettings = new NetCoreAppSettings(Configuration)

And yet, I keep getting the license required exception. Only thing that seems to work is:


What am I missing? I’d much prefer to have this in the appsettings.json file.

I can’t repro this, the license key gets registered at:

Can you try running the same code and get the license key from the configuration and registering it manually:

var key = AppSettings.GetNullableString("servicestack:license");

Mystery solved. In attempting to register it manually per your request, and having to do a “Rebuild” in Visual Studio, it complained the server (IIS Express) was already running. After stopping IIS and running it again, it seemed your code worked. Curious, I removed your code and put it back to the way it was, manually stopped IIS Express and ran it again and low and behold it worked!

The take away seems to be the Appsettings.json file may not be reloaded upon debugging without first stopping IIS Express. This is inconsistent with actual code changes that ARE reflected on a debug without having to stop IIS Express. I wonder why that is?

Thanks for your help.

1 Like

Depends on what those code changes are, if you’re modifying Razor or Sharp Pages they can be reflected immediately without a restart but most changes to C# .cs require a restart unless you have Edit and Continue enabled - which in my Experience doesn’t work very well.