Question

I get this runtime exception when trying to use my new license.

This license is invalid. Please see servicestack.net or contact team@servicestack.net for more details. The id for this license is '[MyLicenseNumber]'

Am I doing anything wrong? I have tried both ways (app.config/code) of registering the license. The application is a console app using the Servicestack.Redis nuget package.

Of course the license is a Servicestack.Redis license and of course the team@servicestack.net have been contacted without reply.

Was it helpful?

Solution 2

Resolved by Updating the servicestack nuget packages.

I'm not sure why that solved my issue because the new version was not a major update (4.0.5 -> 4.0.15). Perhaps it was due to a version mismatch. One of my library projects used version 4.0.12.

I got a reply from team@servicestack.net which confirmed correctness of my usage of the code and the code itself.

OTHER TIPS

If you have followed the examples provided Subscription section of the ServiceStack.net website and it is not working then you will need to wait for your reply from team@servicestack.net, as there must be an issue with the code itself.

Things to note if you are using a console app:

  • You would need to include an app.config not a web.config to configure it from settings file.
  • To configure from code, you need to run ServiceStack.Licensing.RegisterLicense before initialising the AppHost i.e. before appHost.Init();

Web.config / App.config:

<appSettings>
    <add key="servicestack:license" value="XXXX-TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4gUHJvaW4gY29udmFsbGlzIHRyaXN0aXF1ZSBlcm9zIG5lYyBsYWNpbmlhLiBJbnRlZ2VyIHNlZCBqdXN0byBldSBhbnRlIHRpbmNpZHVudCBjb25zZWN0ZXR1ci4gU3VzcGVuZGlzc2UgZ3JhdmlkYSBk" />
</appSettings>

In code self hosted console application:

public static void Main()
{
    ServiceStack.Licensing.RegisterLicense(@"XXXX-TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4gUHJvaW4gY29udmFsbGlzIHRyaXN0aXF1ZSBlcm9zIG5lYyBsYWNpbmlhLiBJbnRlZ2VyIHNlZCBqdXN0byBldSBhbnRlIHRpbmNpZHVudCBjb25zZWN0ZXR1ci4gU3VzcGVuZGlzc2UgZ3JhdmlkYSBk");
    var appHost = new AppHost();
    appHost.Init();
    ...
}

In code ASP.NET application:

protected void Application_Start(object sender, EventArgs e)
{
    ServiceStack.Licensing.RegisterLicense(@"XXXX-TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4gUHJvaW4gY29udmFsbGlzIHRyaXN0aXF1ZSBlcm9zIG5lYyBsYWNpbmlhLiBJbnRlZ2VyIHNlZCBqdXN0byBldSBhbnRlIHRpbmNpZHVudCBjb25zZWN0ZXR1ci4gU3VzcGVuZGlzc2UgZ3JhdmlkYSBk");
}

The license code in the examples are fictitious, replace with your own real code


Also note that if you base64 decode the license key after the prefix of XXXX- you should see the components of the key. If your key does not have data similar to this on decoding, the value may be damaged.

{
    Ref: XXXX,
    Name: Your Name,
    Type: Business,
    Hash: ZGhmc2tqaGZkamtuamt0aDNpdGtqZmtmaGtzamZuazQzaGtmam5za2pzZGhjaWtqbjQzdWhqa3Jl,
    Expiry: 2015-01-01
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top