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

Free Support Forum - aspose.com

Msg = client.FetchMessage(msgInfo.SequenceNumber) yields Nothing on IIS 7

When I'm debugging and testing my code, it finds a message in the native Cassini web server on VS2010. When I deploy the code to the IIS 7 on my development machine, the msg is nothing. It took me a while to figure it out -- at first it was a Object Not Found error. Then I put in all the errMessage items to track down where it breaks. I'm developing on .NET 3.5.

Here's the code:


'// connect to imap server and login



'// get list of messages

msgCollection = client.ListMessages

yesterday = Date.Now.AddDays(-2)

errMessage.Append(" Looping...")

For Each msgInfo As ImapMessageInfo In msgCollection

If msgInfo.Date > yesterday And msgInfo.IsRead = False Then



msg = client.FetchMessage(msgInfo.SequenceNumber)

If msg IsNot Nothing Then

errMessage.Append("Getting message..." + msg.Attachments.Count.ToString())

For Each attachment In msg.Attachments

'to display the the attachment file name

errMessage.Append("Looking for attachment...")

Dim st As String = attachment.ContentType.GetType.ToString()

errMessage.Append("Found attachment...")

If attachment.Name.IndexOf(".pdf") > -1 Then

pdfName = ""

pdfName = attachment.Name

pdf = attachment.ContentStream

errMessage.Append("Getting attachment...")

result = BarCode.ReadBarCode(pdf, pdfName)

errMessage.Append("Processed attachment...")

End If


client.CopyMessage(msgInfo.SequenceNumber, "Processed")


errMessage.Append("Null msg " + msgInfo.SequenceNumber.ToString())

End If

End If



lblStatus.Text += msgCollFinal.Count.ToString() + " emails have been processed. " + errMessage.ToString()


Thanks for considering Aspose.

Could you please download the specific message using Outlook, save it as MSG file and post it here for our reference? You may post the attachment here or send it to me using forum “Contact” --> “Send saqib.razzaq an email”. If you cannot send the message due to confidential information, could you please check if there is anything different in the message e.g. special charcters in subject, attachments, body etc?


All messages fail once I publish to the webserver. I upgraded my whole project to .NET 4.0, upgraded the Application Pool on IIS 7 to .NET 4.0, removed the Aspose Network 3.5 .dll and replaced it with the 4.0 .dll, republished the website, and now everything works.

I hadn’t really wanted to upgrade to 4.0 because now I’ll have to retest everything, but I needed it to work. Is there an issue with the 3.5 .dll?

I don’t really have a way to export that message to Outlook. It’s my personal Gmail that I’m using for testing/dev work, and the account has thousands of emails that I would have to download into outlook just to get that one email, which I really don’t want to do.

The message is a simple email with a few words of text and a 1-page pdf attachment. Every email that I send that has a pdf attachment fails. I can forward you the email or emails if you like.

– Kyle

Hi Kyle,

Yes, please forward the email (on which FetchMessage() returns Nothing) to my email address. I will check it at my end.

I have emailed you my address as we do not recommend posting the email addresses on forums.

Hi Kyle,

There is some issue with 3.5 dll on 64-bit Operating Systems. However, it is being resolved and will be included in the next release. Are you running the project on Windows 7/2008 Server x64?

I'm also seeing this problem with the 2.0 dlls on Windows 7 x64



For others reading this thread in the future, yes I am using Windows 7 64-bit.

Hi David,

Please find the attached hotfix for .NET 2.0 dll on 64-bit systems.