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

Free Support Forum - aspose.com

Aspose SetLicense Method for .Net

I’m trying to Set the license during a Biztalk process, but we get the “Object Reference not set to instance of an object” error. I was wondering if there was a recommended solution regarding setting the license within Biztalk. Please let me know, thanks?

Hi Steve,

Thanks for your inquiry. We will appreciate it if you please confirm how you are applying the license. Please make sure that you have set the license before using any other object of Aspose.Pdf API.

Furthermore. I am afraid there is no specific recommended solution for Biztalk but general recommendations. It is suggested to set license once in some Application Level event. When you will set the license in application level event/scope, it will remain valid till the lifespan of application. Please try to set license as per your application structure and share the results.

  • If you are developing an ASP.NET application, you can call License.SetLicense from the Global.asax.cs (Global.asax.vb) file, in the Application_Start protected method. It is called once when the application starts. Do not call License.SetLicense from within Page_Load methods since it means the license will be loaded every time a web page is loaded.
  • If you are developing a Windows Forms or console application, call License.SetLicense in your startup code, before using Aspose.Pdf for .NET classes.
  • If you are developing a class library, you can call License.SetLicense from a static constructor of your class that uses Aspose.Pdf for .NET. The static constructor will execute before an instance of your class is created making sure Aspose.PDF for .NET license is properly set.
  • in case of WCF service, depending upon its hosting:
- if it is custom ServiceHost - then you can set license in service host start event
- if it is IIS - then set license can be called in Global.asax


We are sorry for the inconvenience.

Best Regards,