How to add service stack license to main .NET project?

For my service stack license, I am using adding an entry to the web config

<add key="servicestack:license" ... />

How can I achieve a similar effect in ServiceStack.Core since there is no web config?

+3


source to share


1 answer


You can register a license key using any of the options listed at: https://servicestack.net/download#register

So, not yet Web.config

, you can use any of the other three parameters, for example to register the SERVICESTACK_LICENSE

Environment Variable.

Also, you don't need to use .NET Core Web.config

or App.config

, you can still use it in .NET Core in ServiceStack to store any <appSettings>

, for example:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <appSettings>
        <add key="servicestack:license" value="{LicenseKey}" />
    </appSettings>    
</configuration>

      



But you will need to explicitly register the license key from AppSettings with:

using ServiceStack;

public class AppHost : AppHostBase
{
    public AppHost() 
        : base("Service Name", typeof(MyServices).GetAssembly()) 
    {
        var licenseKeyText = AppSettings.GetString("servicestack:license");
        Licensing.RegisterLicense(licenseKeyText);
    }

    public override void Configure(Container container)
    {
    }
}

      

Or, if you don't want to use Web.config

, you can use any other AppSettings .

+6


source







All Articles