SetLicenses and multithreading

Sirs:

I have an interesting situation. It seems that the license takes for some threads but not for others in a multi-threaded .NET application. My understanding is that you need to set the license for each application domain, not each application thread.

What I mean by takes, some documents generated via Aspose Words do not show the eval message and some others do.

Any ideas?

This message was posted using Page2Forum from When to Apply a License - Aspose.Words for .NET

Hi Jose,
Thanks for your inquiry.
Yes, as the documentation states, you only need to set the license once per application domain. To avoid this issue you should move the set license call to the start up method of your application which is only executed once.
Please also make sure that you are using the latest version of Aspose.Words. There was a fix regarding the blacklist not being multi-thread safe.
Thanks,

The problem has gone away… For the record…

The problem was very interesting as it was not due to multi-threading. Our setup has multiple virtual machines, each one running an app multi-threaded. If all of the Aspose.Words processing was being done on one VM no problems occured, however if the app started on multiple VMs, only one of the VMs properly registered the license. I did not test VMs on different physical computers, only with VMs (different cores) on a single physical machine.

The app was trying to register the license once per app startup, however since the license registration failed, the result was the eval message for all the threads on the VM. The solution was to flag the first registration (at app startup) as failed and retry the registration at the time the component (Document) was being created and re-register.

We just created wrappers for the components (except for Slides which is sealed?) and the problem has gone away.

By the way, the problem seems to occur only with Words (V 9.7.0.0, which is the last one that has been tested in our setup). I will go ahead and start the download and testing of the absolute latest Total package later this week.

Hi
It is perfect that you managed to resolve the problem. Also, I would suggest you to try using the latest version of Aspose.Words (9.8.0). There was a fix of licensing code in this version. Maybe it will resolve the problem you have.
You can download the latest version from here:
https://releases.aspose.com/words/net
Best regards,