Hello,
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:
System.TypeInitializationException
WILCO_CAS1
The type initializer for ‘Simmons.Library.OutlookAspose’ threw an exception.
System.IO.FileNotFoundException
Aspose.Email
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.Linq.Enumerable.WhereSelectArrayIterator2.MoveNext()
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
License.SetLicense(“Aspose.Total.lic”)
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
'p66.myfueltanksolutions.com
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
ExchangeWebServicesClient.Send(MailMessage)
End Sub
End Module