We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

.Net SetLicense is throwing NullReference and IndexOutOfBounds Exceptions

Hi,

Our customer has a 10 site enterprise license. Locally on developer machine this works fine but when deployed to server we are seeing two recurring errors when we try to load License from embedded resource:

"Object Reference not set to an instance of an object"

"Index was outside bounds of the array"

Product is Aspose.Words .Net 8.2.0.

The License is loaded in the constructor of a WCF service each time the service is called. This error does not occur all the time and not in any noticeable pattern.

We are going to change to load the license once in Global.asax but would like to understand why the above errors are happening.

Code that loads license is:

var wordsLicense =new Aspose.Words.License();

wordsLicense.SetLicense("Aspose.Words.lic");


This message was posted using Aspose.Live 2 Forum

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. The problem might occur because you apply license on each service call. In general, there should not be any problem with this, but maybe in your case problem occurs because concurrent access to the license file resource.

The license should be applied only once per application domain, when application starts, in this case you will not have any licensing issues in the future. Please see the following link to learn when to apply license:

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net-and-java/when-to-apply-a-license.html

Best regards.