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

Free Support Forum - aspose.com

Aspose.Email finds license in DEV- but not in PROD


I stuck my lic file in a subfolder of the project, not in the root. I made it embedded resource, do not copy. My license code is in a module not a class.

My code works in the DEV environment but not in production. Any idea why?
Same code in both places.

Error we get in production:
The type initializer for ‘Simmons.Library.OutlookAspose’ threw an exception.
Cannot find license ‘Aspose.Total.lic’.

œ…™(String , Assembly )
œ…•(String , Assembly )
WILCO_CAS1.Report._Lambda$__2(String FileName) in C:\Simmons\VSS\dotNET\WILCO\1.5\ReportGenerator\Active Reports\WILCO_CAS1\WILCO_CAS1\Report.vb:line 88

System.Collections.Generic.List1…ctor(IEnumerable1 collection)
System.Linq.Enumerable.ToList[TSource](IEnumerable1 source)
WILCO_CAS1.Report.get_Messages() in C:\Simmons\VSS\dotNET\WILCO\1.5\ReportGenerator\Active Reports\WILCO_CAS1\WILCO_CAS1\Report.vb:line 87
WILCO_CAS1.Report.BuildReport() in C:\Simmons\VSS\dotNET\WILCO\1.5\ReportGenerator\Active Reports\WILCO_CAS1\WILCO_CAS1\Report.vb:line 293
Simmons.Reporting.Wilco.Report.Produce(Object aParams, String sPathToOutput) in C:\Simmons\VSS\dotNET\Simmons\Simmons.Reporting\Wilco\Report.vb:line 390

Here is my license code:

Imports Aspose.Email
Imports Aspose.Email.Exchange
Imports System.Net

Public Module OutlookAspose

'Instantiate the License class
Private License As License = New License()

Sub New()
'Pass only the name of the license file embedded in the assembly
End Sub

Public Function CreateMailItem(FileName As String) As MailMessage
Return MailMessage.Load(FileName)
End Function

Public Function MailHeader(MailMessage As MailMessage) As String
Return String.Format(“From: {0}
Sent: {1}
To: {2}
Subject: {3}

”, MailMessage.From.DisplayName, MailMessage.Date, MailMessage.To(0).DisplayName, MailMessage.Subject)
End Function

Public Sub Send(ServerName As String, UserName As String, Password As String, Domain As String, [From] As String, [To] As String, Subject As String, Body As String)
’ Create instance of ExchangeClient class by giving credentials
Send(ServerName, From, [To], Subject, Body, New NetworkCredential(UserName, Password, Domain))
End Sub

Public Sub Send(ServerName As String, [From] As String, [To] As String, Subject As String, Body As String, Optional Credentials As NetworkCredential = Nothing)
Credentials = If(Credentials, System.Net.CredentialCache.DefaultNetworkCredentials)

Dim ExchangeWebServicesClient As IEWSClient = EWSClient.GetEWSClient(String.Format(“https://{0}/ews/exchange.asmx”, ServerName), Credentials)
’ Create instance of type MailMessage
Dim MailMessage As MailMessage = New MailMessage()
MailMessage.From = [From]
MailMessage.To = [To]
MailMessage.Subject = Subject
MailMessage.HtmlBody = Body

’ Send the message

End Sub

End Module

Hi Todd,

Thank you for writing to Aspose support team.

The exceptions shows that your application can not find the license file. Please make sure that you are referring to the correct path where the license is located. You may first create a sample application that uses only FileStream for accessing the file on the server. This will ensure that the path is correct and you can then use the same path in your application.

It does not appear that you read my question.

It is an EMBEDDED RESOURCE. It is not a file path or a stream.
But it is not in the root of the project. It is in a subfolder.

The documentation says it will find an embedded resource without the path.

Since it is in a subfolder of the project, can Aspose not find the embedded resource?
How do I need to change it so that it finds it in a subfolder?

Hi Todd,

We are sorry for the inconvenience caused to you.

I have re-tested this issue at my end using the same scenario as you have mentioned, but there is no exception raised and the license is applied properly in our application. Could you please share more details about your production server with us? If possible, please provide us with your sample project so that we can test it at our end (You may request a 30-day temporary license free of cost for sharing with us) and share our feedback with you.