License Not Found - Embedded Resource in .Net Web Application

I'm using Aspose Email in a .Net web application. I've added the Aspose.Email.lic file to the root of my web app project as an embedded resource. I'm calling SetLicense from global.asa Application_OnStart event handler. Everything works fine when run locally but not when the web app is deployed to our production server. The exception is show below. Where is the appropriate place to call SetLicence in these circumstances and/or why isn't it working?

[FileNotFoundException: Cannot find license 'Aspose.Email.lic'.]
œ..™(String , Assembly ) +401
œ..•(String , Assembly ) +187

[HttpException (0x80004005): Cannot find license 'Aspose.Email.lic'.]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +4071733
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +191
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +352
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +407
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +375

[HttpException (0x80004005): Cannot find license 'Aspose.Email.lic'.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +11799824
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +141
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +4935077
v

Hi Bernie,


Thank you for writing to Aspose support team.

Could you please try not passing complete path to the SetLicense method? i.e. license.SetLicense(“Email.lic”) should work in this case. Please try it at your end and let us know your feedback.

Changing the name of the file worked. Perhaps your sample code should be changed.

Bernie,


Its good to know that your problem is solved now. Please feel free to write to us in case you have any other query/inquiry related to Aspose.Email. We’ll be glad to assist you further.