Problem with licence initialization

Hello,

We have two server 2003 machines under NLB .

On each machine we have deployed WCF .NET 3.5 service .( same binaries on each one )

This WCF can convert .doc to HTML .

When request goes to server A , everything is OK , but when request on server B , we got a red line telling that aspose is under evaluation mode .

The license is compiled as resource into DLL , and licence object initialized in static class .

We tried to inovoke IISRESET , redeploy the binaries and many other things .

We are using version 9.5.0.0

We cant upgrade to newer version due to the reason that our licence has expired .
( Developer Enterprise Subscription )

Thanks .

Hi,
Thanks for your request. Please, check the following points:

  • Make sure your call to SetLicense gets executed. Step through in the debugger.
  • Make sure your code does not catch an exception thrown by Aspose.Words licensing code. For example, Aspose.Words will throw if it cannot find the license.
  • Make sure the input documents do not already have the evaluation message. Aspose.Words does not delete existing evaluation messages.
  • Make sure SetLicense is executed before you instantiate any Document object.

Best regards,

Thanks for your reply

The main issue is that the same binaries are deployed on both servers , but works correctly on only one of them .
Suppose that I have two servers A and B .

On A it works and on B it does not .

If I will disconnect A , all request will go to B and all messages will contain evaluation warning .
When only A will be connected , all messages will be OK .

Hello
Thank you for additional information. This might occur, if you apply license after instantiating Document object. Also, please make sure that code executes without exceptions. You can try putting license code into try-catch statement. Maybe this could help you to analyze the problem.
Where exactly do you call set license method?
Best regards,

Thanks again for you reply .

But how it can explain the fact that on other server it works ?

It is very hard to check what you suggest , because it is production envelopment .

What could be a reasons for such behavior ?

Hi
Thanks for your request. Unfortunately, it is quite difficult to tell you what the problem is.
In order to test the process of setting the license you can add the code that will write to log and see whether the license is set properly.
Best regards,

Does Aspose provide some API which can help me to determine if licence is set ?

if yes I can invoke such API , before I start using aspose . ( at least at debug stage ) .

I have wcf service , with some static helper class , in which I am setting the license . Because this class is static , licence set once and before using aspose API

Hi
Thanks for your request. There is no such API. But I think you can try using code like the following to check whether license is set:

///
/// Returns true if the Aspose.Words license is set.
///
private static bool IsLicenseSet()
{
    // We will insert this text at the beggining of the document.
    // If the license set this text will be in th efirt paragraph,
    // if not an evaluation watermark will be in the first paragraph.
    const string text = "This is text used to check if the license is set";
    Document doc = new Document();
    DocumentBuilder builder = new DocumentBuilder(doc);
    builder.Write(text);
    // Save and open the document. If Aspose.Words works in evaluation mode it will add a watermark.
    using(MemoryStream docStream = new MemoryStream())
    {
        doc.Save(docStream, SaveFormat.Doc);
        docStream.Position = 0;
        doc = new Document(docStream);
    }
    // Check text of the first paragraph.
    return (doc.FirstSection.Body.FirstParagraph.ToTxt().Trim() == text);
}

Hope this helps.
Best regards,