We are experiencing occasional issues where our applications are unable to connect to Aspose’s license server.
For example, we have encountered HTTP 502 and 503 errors when accessing the following URL:
https://billing.aspose.com/v2.0/billing/users/metered/aspose{key}/subscription?meteredPrivateKey={key}
When these errors occur, our experience is that Aspose switches from production mode to trial mode, preventing us from generating PDFs. Instead, we receive the following error message:
“At most 4 elements (for any collection) can be viewed in evaluation mode.”
Additionally, we have also encountered HTTP 503 errors when calling id.aspose.cloud/connect/token
, which similarly results in PDF generation failures.
These issues were observed, for example, on both February 3rd and 4th.
Could you please investigate these connectivity issues and advise on how we can prevent them from occurring in the future?
Best regards
@alfinans
Could you please provide more details about your network setup and any specific configurations you have in place that might affect connectivity to the Aspose License Server?
Hi
We are experiencing these errors both locally (in our office in Copenhagen, Denmark) and from app services and VMs running in Azure (Western Europe).
We experience the errors simultaneously in these environments, so it’s clearly not related to our local network.
@alfinans
Are you consuming Aspose.Total Cloud APIs? Can you please share a bit more information about the server and your application routine?
We are using a metered license with for instance Aspose.PDF.dll and Aspose.Cells.dll from various C# applications, running in different Azure app services and VMs.
And as mentioned we are seeing the exact same issues when running applications locally, so it seems obvious that it has nothing to do with the Azure environment or our local environment.
Periodically these Aspose assemblies call an Aspose-license server, and occasionally these calls fail, which causes Aspose to enter trial-mode.
@alfinans
We are collecting related information and will get back to you soon.
@alfinans
We have investigated the cause of the issue and found that it was due to the connectivity issue on servers. We have worked on it already and it is stable now. At the moment, we are observing it closely and making sure that it does not happen again. However, it is marked as resolved from our side. In case you face any issues like this in future, please feel free to let us know. We are sorry for the inconvenience that may have been caused due to this.
Hi
Yesterday we ran into the issue again, and we can see that the server is unavailable right now again.
I’ve just noticed that on our corporate wifi I’m getting HTTP 403 when accessing https ://billing.aspose.com/v2.0/billing/, but when I do it on my cellphone I’m getting HTTP 200.
It may be a hint for you guys 
@alfinans
We have opened the following new ticket(s) in our internal issue tracking system and will investigate this case in details.
Issue ID(s): PDFNET-59278
As soon as we have some results against the investigation, we will inform you. Please spare us some time. We are sorry for the inconvenience.
@alfinans
We have checked the logs and it looks like you are setting license too often e.g. 300 calls per day which is not recommended at all. this way you are exposing yourself to networking issues
Please follow these instructions:
-
“Do not call the SetMeteredKey method frequently so that this licensing method properly accumulates consumption and reports it to us. Just instantiate the Aspose.PDF library, call SetMeteredKey once, then leave the library instantiated and reuse it.”
-
“Normally it is enough to apply the metered license once on application start. However, if the metered licensing mechanism fails to communicate with the Aspose servers for 24 hours, Aspose.PDF will exit licensed mode and switch to evaluation mode. To avoid such case, you should regularly check the license status – if Aspose.PDF turns into evaluation mode, please apply the metered license again.”
Please try to use a singleton pattern or something similar to instantiate and apply the license only once. The license will work for 24 hours without the need to contact the licensing server.
After 23 hours or if this method fails (Metered.IsMeteredLicensed | Aspose.PDF for .NET API Reference):
you should apply the license again.
Hi
It’s a temporary monitoring application that is setting the license frequently, our “real” applications are setting it once on start-up.
Can you please elaborate on the 23/24 hour limit, because we have an application that is restarted daily which entered trial-mode a couple of times, so it seems there must be circumstances where the time-limit isn’t honored.
@alfinans
This means that once you set the metered license in your application which is live, the license will work for 24 hours without creating a need to connect to the licensing server. We are working on increasing this period but it is gonna take some time to finalize the decision.
@alfinans
You must use the above recommendation otherwise the 24h allowance won’t work. You must keep the library instantiated and call SetMeteredKey at startup or if IsMeteredLicensed fails.
Hi
I’ve looked at the proposed solution and as far as I can tell, IsMeteredLicense cannot be used proactively. We may for instance call IsMeteredLicense and it may return true, but immediately thereafter the production of a PDF may fail. So it seems IsMeteredLicense indicates whether the previous PDF failed to be produced due to a missing license.
I’ve created a small C# application that demonstrates this behavior:
using Aspose.Pdf.Text;
Console.Write("Public key: ");
var publicKey = Console.ReadLine();
Console.Write("Private key: ");
var privateKey = Console.ReadLine();
try
{
Console.WriteLine("Setting license");
new Aspose.Pdf.Metered().SetMeteredKey(publicKey, privateKey);
Console.WriteLine("License has been set :)");
Console.Write("Turn off the internet and then press ENTER!");
Console.ReadLine();
for (var i = 1; i < 10; i++)
{
try
{
Console.Write($"Press ENTER to create PDF #{i}");
Console.ReadLine();
Console.WriteLine($"Is licensed: {Aspose.Pdf.Metered.IsMeteredLicensed()}");
Console.WriteLine("Creating PDF with multiple pages");
Console.WriteLine("Creating Document instance");
var document = new Aspose.Pdf.Document();
Console.WriteLine("Setting title");
document.SetTitle(DateTime.Now.ToString());
Console.WriteLine("Adding paragraph with TextFragment");
document.Pages.Add().Paragraphs.Add(new TextFragment(DateTime.Now.ToString()));
Console.WriteLine("Add page #2");
document.Pages.Add();
Console.WriteLine("Add page #3");
document.Pages.Add();
Console.WriteLine("Add page #4");
document.Pages.Add();
Console.WriteLine("Add page #5");
document.Pages.Add();
Console.WriteLine("Saving PDF");
document.Save($"{i}.pdf");
Console.WriteLine("Saved PDF :)");
}
catch (Exception ex)
{
Console.WriteLine($"Failed to create PDF: {ex.Message}");
}
}
}
catch (Exception ex)
{
Console.WriteLine($"Error: {ex.Message}");
}
Console.WriteLine("Press ENTER to exit");
Console.ReadLine();
To demonstrate the IsMeteredLicense issue do the following:
- Run the application and enter your public and private keys
- Wait for the “License has been set :)” message
- Turn off your internet and press ENTER
- Press ENTER and notice that IsMeteredLicense returns true
- Notice that an error occurs when producing the PDF
The application can also be used to demonstrate a deadlock issue:
- Perform step 1 through 5 mentioned above.
- Press ENTER a few more times and notice that
new Aspose.Pdf.Document()
hangs
Here’s a screenshot of the expected output:
image.png (67.9 KB)
@alfinans
Thanks for sharing more information. We have updated the ticket information and will use it for further analysis. We will let you know once we have some updates to share in this regard. Please spare us some time.
We are sorry for the inconvenience.
Hi
We have added additional logging to our applications and have noticed that Aspose.OCR.Metered.GetConsumptionCredit() seems to cause exceptions while for instance Aspose.Cells.Metered.GetConsumptionCredit() and Aspose.Pdf.Metered.GetConsumptionCredit() don’t.
Every tenth minute we have an application that checks the consumption credit on Cells, Pdf, OCR and Words and we have only seen it fail on the OCR-check.
We’ve seen it fail on the following times (all UTC)
- February 13th at 02:30:14 AM
- February 13th at 03:20:16 PM
- February 15th at 05:40:08 AM
- February 16th at 11:50:14 PM
- February 17th and 06:40:16 PM
On the 15th we caught it as a HTTP 500 WebException. In all other cases we have caught it as an obfuscated exception type with the message “not allowed”.
@alfinans
We have also tested using the console application you shared with the steps mentioned by you and could not replicate the issue.
Are you saying that the original issue that you mentioned in this thread is basically happening because of the Aspose.OCR.Metered.GetConsumptionCredit() method by Aspose.OCR API? Can you please confirm if you are using the latest version of the API? Also, does this method throw exception every time you call it or is it intermittent? Please share some steps to reproduce it with the latest version and we will further proceed to assist you accordingly.
Hi
Regarding the console application, the csproj-file looks like this and the error is reproducable in both .NET 7, 8 and 9:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Aspose.PDF" Version="25.2.0" />
</ItemGroup>
</Project>
Will you please share the console output with me or elaborate on what or how you couldn’t reproduce the issue. It’s happening completely consistently when I run the application, so I would assume that it will when you run it too.
Regarding OCR. No, the original issue is not related to OCR at all, as the application it’s happening in only uses Aspose PDF. The original issue is related to an application that is restarted daily at 2 AM, which set’s the Aspose license once on start-up, and which does not monitor the license state or try to recover in case license errors suddently starts occurring.
I’m just trying to provide you with my observations and details so you can troubleshoot things on your end.
The method is not throwing exceptions consistently, and the exception it throws varies too. Today we got a “System.Net.Sockets.SocketException (10054): An existing connection was forcibly closed by the remote host” at 05:40 PM (UTC) on two separate Azure App Services simultanously when they performed a check that invokes the various GetConsumptionCredit-methods, and once again we were able to call GetConsumptionCredit on both Cells and PDF, but the exception was thrown when we did it on OCR.
@alfinans
We used same code snippet that you shared in a .NET 8 Console Application. Below is the console output that we received:
Setting license
License has been set :)
Turn off the internet and then press ENTER!
Press ENTER to create PDF #1
Is licensed: True
Creating PDF with multiple pages
Creating Document instance
Setting title
Adding paragraph with TextFragment
Add page #2
Add page #3
Add page #4
Add page #5
Saving PDF
Saved PDF :)
Press ENTER to create PDF #2
Is licensed: False
Creating PDF with multiple pages
Creating Document instance
Setting title
Adding paragraph with TextFragment
Add page #2
Add page #3
Add page #4
Add page #5
Saving PDF
Saved PDF :)
Press ENTER to create PDF #3
Is licensed: False
Creating PDF with multiple pages
Creating Document instance
Setting title
Adding paragraph with TextFragment
Add page #2
Add page #3
Add page #4
Add page #5
Saving PDF
Saved PDF :)
Press ENTER to create PDF #4
Is licensed: False
Creating PDF with multiple pages
Creating Document instance
Setting title
Adding paragraph with TextFragment
Add page #2
Add page #3
Add page #4
Add page #5
Saving PDF
Saved PDF :)
Press ENTER to create PDF #5
Is licensed: False
Creating PDF with multiple pages
Creating Document instance
Setting title
Adding paragraph with TextFragment
Add page #2
Add page #3
Add page #4
Add page #5
Saving PDF
Saved PDF :)
Press ENTER to create PDF #6
Is licensed: False
Creating PDF with multiple pages
Creating Document instance
Setting title
Adding paragraph with TextFragment
Add page #2
Add page #3
Add page #4
Add page #5
Saving PDF
Saved PDF :)
Press ENTER to create PDF #7
Is licensed: False
Creating PDF with multiple pages
Creating Document instance
Setting title
Adding paragraph with TextFragment
Add page #2
Add page #3
Add page #4
Add page #5
Saving PDF
Saved PDF :)
Press ENTER to create PDF #8
Is licensed: False
Creating PDF with multiple pages
Creating Document instance
Setting title
Adding paragraph with TextFragment
Add page #2
Add page #3
Add page #4
Add page #5
Saving PDF
Saved PDF :)
Press ENTER to create PDF #9
Is licensed: False
Creating PDF with multiple pages
Creating Document instance
Setting title
Adding paragraph with TextFragment
Add page #2
Add page #3
Add page #4
Add page #5
Saving PDF
Saved PDF :)
Press ENTER to exit
After creating first PDF, the Is Licensed
Calls produced False
output. However, all the PDFs generated by the application were produced with active license (without evaluation mark) despite the method Aspose.Pdf.Metered.IsMeteredLicensed()
returning false
. Attached are the outputs generated by the application:
Files.zip (11.7 KB)