Search code examples
c#servicestackilmergesmartassembly

ServiceStack license error after packaging


In my ServiceStack client application, everything was fine until I have tried packaging it with SmartAssembly or ILRepack. There are three DLLs: (ServiceStack.Client.dll, ServiceStack.Interfaces.dll, ServiceStack.Text.dll) Which when packed cause my application to crash, no matter whether I use encryption\obfuscation options or just pack them into one EXE. My app is targeting .NET 4.0 (I want to support win XP). Stack trace of the exception is:

ServiceStack.LicenseException: Unauthorized access request of a licensed feature. Type: 'AccessToken', Assembly: 'ClientTester.exe', 'My EXE path'
ServiceStack.Net40PclExport.VerifyInAssembly(Type accessType, ICollection`1 assemblyNames)
ServiceStack.LicenseUtils.RequestAccess(Object accessToken, LicenseFeature srcFeature, LicenseFeature requestedAccess)
ServiceStack.JsonServiceClient.ToJson[T](T o)
ServiceStack.EncryptedServiceClient.CreateEncryptedMessage(Object request, String operationName, Byte[] cryptKey, Byte[] authKey, Byte[] iv, String verb)
ServiceStack.EncryptedServiceClient.Send[TResponse](String httpMethod, Object request)

I can't install the patch as the installer says that it is blocked or the conditions are invalid. In addition, I am not sure that this patch would help me. Any ideas are welcome.
Sidenote: another ServiceStack application, which uses other ServiceStack DLLs except aforementioned ones works well even when packed.


Solution

  • It looks like the absence of an explicitly installed .NET Framework 4.0 is causing that issue. If I compile the solution for 4.5\4.6 version and pack it - everything is fine. Also compiling and packing it for .NET 4.0 and using it on PC that EXPLICITLY has this version installed works as well