Setting a License in Aspose.BarCode takes too long

Hi,
I set license in Aspose.BarCode will take 700ms. codes are below,

var licPath = @“C:\projects\Aspose.lic”;
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
var barcodeLic = new Aspose.BarCode.License();
barcodeLic.SetLicense(licPath);
stopWatch.Stop();
// Get the elapsed time as a TimeSpan value.
TimeSpan ts = stopWatch.Elapsed;
Console.WriteLine(ts.Milliseconds);

environments
windows 10, ram 8g , i7, 256 ssd

barcodeSetLic.png (4.1 KB)

@rainmaker_ho,

We have executed the sample code shared by you. It took 65 Milliseconds to set the Aspose.BarCode license. Specifications of the machine are:

8 GB RAM
Core i7, 6700 HQ @ 2.6GHz

We have used the latest version of the Aspose.BarCode APIs for testing.

@ikram.haq,
I use Aspose.BarCode 17.10.0 from nuget .
License type is Aspose.Total for .NET.
I remove other Aspose components(Words, PDF).
It spend about 500ms ~ 600ms.

8 GB RAM,
Core i7-4500U @ 1.80GHz 2.40GHz
Win10 x64

Thanks for your help.

@rainmaker_ho,

We have almost the same configurations that are:

8 GB RAM
Core i7, 6700 HQ @ 2.6GHz
64 bit Windows 10
License: Aspose.Total

Please forward us a sample project demonstrating the issue. We will evaluate it and update you about our findings.

@ikram.haq,
The attach file is my testing project wordTest.zip (2.2 MB)

Thanks for your help

@rainmaker_ho,

Thank you for sharing sample project. We have executed the sample project. It took 162 Milliseconds. Screenshot of the output screen is attached for your reference.
barcode_time_test.jpg (92.2 KB)

@ikram.haq,
I have a question.
Why do we get different results (65ms vs 162ms) with my project and your original project in your computer ?
I thank codes are the same.

@rainmaker_ho,

Yes, you are right. The codes are same the only difference is that i took out the statement creating barcode instance out of the start & stop method calls. Build the project and executed the .exe from bin/release folder.

@ikram.haq,
Is there the best way to set license ?
Thanks.

@rainmaker_ho,

There are two methods to set license:

  • By using string path
  • By using Stream.

From performance point of view they are almost equal. However, an investigation ticket has been created in our system with ID BARCODENET-36722 for further investigation by our Product team. We will update you here once there is some information or a fix version available in this regard.

@ikram.haq,
Thanks for your help

@rainmaker_ho,

The issue (BARCODENET-36722) has been resolved. Please download the latest version of Aspose.BarCode for .NET and try it at your end.

1 Like

Thanks , it spend about 250 ~ 350 ms.

I want code , how to get license file to mvc app

@Vinh,

Code to set the license in MVC application will look like as below. Assuming that the license file is in “App_Data” folder.

CODE:

    private void SetAsposeLicense(IHostingEnvironment env)
    {
        string basedir = env.ContentRootPath;
        string licPath = Path.Combine(basedir, "App_Data", "Aspose.BarCode.lic");
        Aspose.BarCode.License lic = new Aspose.BarCode.License();
        lic.SetLicense(licPath);
    }

The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan