Initializing the license file

I'm trying to apply the Aspose.Words.lic file in my (.NET 4, MVC3) web application. I've tried the following locations.
  • Global.asax, Application_Start - both inline and as a call to a static void method
  • Non-static managed service method
  • Controller action
The following error happens to be copied from the first bullet point, but all are throwing the error below. Am I trying to run the code in the wrong place? Is there something I need in the Web.Config to allow this code to run? Google has not provided an answer thus far, so any suggestions or help would be appreciated.

The invoked member is not supported in a dynamic assembly.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NotSupportedException: The invoked member is not supported in a dynamic assembly.

Source Error:

Line 27: 		private static void InitializeAsposeLicense() {
Line 28: 			Aspose.Words.License asposeLicense = new Aspose.Words.License();
Line 29: 			asposeLicense.SetLicense("Aspose.Words.lic");
Line 30: 		}
Line 31: 

Source File: C:\Source\...\Global.asax.cs Line: 29

Stack Trace:

[NotSupportedException: The invoked member is not supported in a dynamic assembly.]
   System.Reflection.Emit.InternalAssemblyBuilder.GetManifestResourceNames() +56
   x28925c9b27b37a46.x220f433da4115056.x0004f58017c756bc(Assembly xd3764619ec304ff0, String xf3a1146bd8778bac) +25
   x28925c9b27b37a46.x220f433da4115056.xde6236852622c268(String x1c1fc72fe1a3b4ea, Assembly x39e0a96279c40baa) +315
   x28925c9b27b37a46.x220f433da4115056.x7d0214bf69711dd9(String x1c1fc72fe1a3b4ea, Assembly x5807f920b6fc67c4) +112
   Aspose.Words.License.SetLicense(String licenseName) +86
   Dematic.Mobile.Web.MvcApplication.InitializeAsposeLicense() in C:\Source\...\Global.asax.cs:29
   Dematic.Mobile.Web.MvcApplication.Application_Start() in C:\Source\...\Global.asax.cs:45

[HttpException (0x80004005): The invoked member is not supported in a dynamic assembly.]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +9171773
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +131
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +194
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +339
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +253

[HttpException (0x80004005): The invoked member is not supported in a dynamic assembly.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9090876
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +97
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +256



Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272

Hi Nicholas,


Thanks for your inquiry. Please create and attach here a simple Web Application that helps me to reproduce the same problem on my side. I will investigate the issue on my side and provide you more information.

Best Regards,

We use a 3rd party application in which we can extend its functionality by via writing custom code and configuring the application to access it via reflection. When trying to access the code which initializes a trial license, I get "The invoked member is not supported in a dynamic assembly."

Is instantiation via reflection supported by Aspose.Words?

I have the following testing cases and results:

  • Run same code without license on server via reflection: Success (output document has nasty red “Evaluation Only” as expected)
  • Run same code with license on server via reflection: Error: "The invoked member is not supported in a dynamic assembly."
  • Run same code with license locally from test harness (no reflection): Success

Joe J

Hi Joe,


Thanks for your inquiry. I am not sure what could be the exact cause of this problem; however, I would suggest you please do the following:

  1. In case you’re using an older version of Aspose.Words, please try upgrading to the latest version of Aspose.Words 13.1 from here.
  2. Secondly, maybe you should embed the Aspose.Words.lic file in your third party application as an EmbeddedResource. Please read this article on how to include the License File as an Embedded Resource.

I hope, this helps.

Best regards,

I am getting this error as well. Using Aspose.Words 13.4 and have the license file embedded. If I take out the license line, things work fine but I get the evaluation mode note on the generated Word doc.

Any ideas? The site runs on .NET 4.5, Windows Server 2008 R2.

Susquehanna Bank:

I am getting this error as well. Using Aspose.Words 13.4 and have the license file embedded. If I take out the license line, things work fine but I get the evaluation mode note on the generated Word doc.

Any ideas? The site runs on .NET 4.5, Windows Server 2008 R2.


I ended up having to move the [license embed] code into the service class instead of Global.asax. That seemed to fix the issue.

I have it working now. I had to move the license code into global.asax app start and out of my class's constructor.

I got this error when I had a separate licence for the Barcode and Word assembly. I was using static constructors of the respective classes using the respective components to new up the licences. The first would load fine, but the second would. Interestingly this isn’t an issue if you use a licence that covers both products, such as the Total package. Maybe there’s something to be looked into there… multiple licences.

In my case I don’t have an MVC or webforms site, this is a library and my test classes are failing, and I’m not keen on moving the licencing calls outside of the library when working with embedded licences.

Hi Grover,


Thanks for the additional information. But, even if you have Aspose.Total.lic, you still need to set a license separately for each Aspose product you are using. For example, if you are using Aspose.Words and Aspose.BarCode, code for setting the license will look like this:

Aspose.Words.License awLic = new Aspose.Words.License();
awLic.SetLicense(“Aspose.Total.lic”);

Aspose.BarCode.License bcLic = new Aspose.BarCode.License();
bcLic.SetLicense(“Aspose.Total.lic”);

Secondly, it would be great if you please create a standalone/runnable simple application (for example a Console Application Project) that helps me reproduce your problem on my end and attach it here for testing. As soon as you get this simple application ready for me, I’ll start investigation into your issue and provide you more information.

Best regards,