Issue setting Aspose License

Hi,

I have a base handler which is being inherited by all other handlers which uses the Aspose for doing various tasks.

I have created a singleton class to set up the aspose license. I call the SetLicense method of this class on the OnBeginRequest() event of the base handler. But on the server where i have deployed the application i get error in

asposeTotalLicence.SetLicense(asposeFileName);

erro: Unable to locate Aspose Licence file:Aspose.Total.lic

Following ist he code for that singleton class

class AsposeLicense

{

private const string DEFAULT_ASPOSE_LIC_FILE = "Aspose.Total.lic";

private static bool __isLicenseSet = false;

protected AsposeLicense()

{

}

public static void SetLicense()

{

if (!__isLicenseSet)

{

string asposeFileName = string.Empty;

try

{

asposeFileName = DEFAULT_ASPOSE_LIC_FILE;

Aspose.Pdf.Kit.License asposeTotalLicence = new Aspose.Pdf.Kit.License();

if (string.IsNullOrEmpty(asposeFileName))

throw new Exception();

asposeTotalLicence.SetLicense(asposeFileName);

__isLicenseSet = true;

}

catch (Exception ex)

{

throw new Exception("Unable to locate Aspose Licence file:Aspose.Total.lic");

}

}

}

}

I have properly placed the .lic file in the bin folder of the application where it is deployed and i am not getting the evaluation version error.

Is there a possibility that because of the multiple async calls to the base handler i am getting this error. Once i get this error, it keeps getting the same error.

Could you help me in identifying the cause of this issue.

Thanks

Hi Kashish,

Please share a small sample application with us, which can help us reproduce the same issue at our end. Please Do Not include the license file in the sample project. We’ll test the issue at our end and update you accordingly.

We’re sorry for the inconvenience.
Regards,

Hi,

PFA the attached POC of my code. This works fine when the setLicense is called from only one child handler at a time. The problem occurs when the multiple child handlers invoke the setLicesnse method in basehandler.

Regards

Kashish

Hi Kashish,

Can you please try to set the license once per application at your end? That is, you can set the license in Application_Start event in Global.asax.cs file. I hope this is going to resolve your issue. If you still find the same issue, please do let us know.

We’re sorry for the inconvenience.
Regards,