The underlying connection was closed: An unexpected error occurred on a receive

I'm trying to download mailMessage from exchange 2010 sp1 using EWS.
any attempt to call "FetchMessage" function cause WebException
The underlying connection was closed: An unexpected error occurred on a receive.
ListMessages, DeleteMessage, GetMailboxInfo works win no problems.
Any ideas way this happens?

ServicePointManager.ServerCertificateValidationCallback =
delegate(Object obj, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors)
{
// trust any certificate
return true;
};
changeWebServiceClient client = new ExchangeWebServiceClient(@"https://vm-dctest/ews/Exchange.asmx",
new NetworkCredential("ss", "123", "testdomain"));
var fi = client.GetFolderInfo(client.GetMailboxInfo().InboxUri);
MapiContactCollection map= client.ListMailboxes();
foreach (var item in client.ListMessages(fi.Uri))
{
client.FetchMessage(item.UniqueUri);
}


// UPD
I have successfully downloaded mail Messages
using EWS 2.0 (Microsoft.Exchange.WebServices)
What I'm doing wrong with aspose.email ?

Hi,

Thank you for using Aspose.Email.

I tried to reproduce your issue using the latest version of Aspose.Email for .NET and the following code, but was unable to get success in this. Can you please tell us what you want to achieve? I would request you to please give a try to the following code and let us know your feedback. You can also have a look at our detailed Programming guide available online HERE .

ExchangeWebServiceClient client = GetEWSClient();

Console.WriteLine("Connected to Exchange 2010");

Console.WriteLine("Exchange Version: {0}", client.GetVersionInfo());

// Call ListMessages method to list messages info from Drafts

ExchangeMessageInfoCollection msgCollection = client.ListMessages(client.MailboxInfo.DraftsUri);

// Loop through the collection to get Message URI

foreach (ExchangeMessageInfo msgInfo in msgCollection)

{

string strMessageURI = msgInfo.UniqueUri;

// Now get the message details using FetchMessage()

MailMessage msg = client.FetchMessage(strMessageURI);

// Display message details

Console.WriteLine("Subject: " + msg.Subject);

}

If the issue still persits, please provide us a runnable console application along with a test account on your server, so that we can reproduce the issue at our end and assist you further.

Hello.
I have found where was the problem.
This exception rises when there are no "Default Accepted Domain" set in exchange configuration.
Thanx for your help. This error accidentally was found while preparing access to our server for you. I have spend 2 days searching for it with no success, but now everything is works fine :)

Hi,


Thank you for the feedback.

Its good to know that your problem is solved now. In case you have any other query/inquiry, please feel free to contact us. We will be glad to assist you further as soon as possible.