Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Sending Email Asynchronously
Message
De
18/01/2013 13:01:20
 
 
À
18/01/2013 12:54:41
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01563134
Message ID:
01563289
Vues:
38
>>>>Superb! Thanks once again Viv. What is interesting is that all the email is now being sent, but the code never hits the SendCompletedCallback.
>>>>
>>>>Oh, it also does not seem to be running asynchronously as I don't get control back in the UI for quite a while.
>>>>
>>>>One of these days I'll understand C# :(
>>>
>>>Viv,
>>>
>>>I commented out the wiatHandle.WaitOne(); and then my code stopped hanging. Do I need that line of code in there? Is it just in the wrong place?
>>
>>I think you need it - otherwise the whole PostAWBS method will exit before the async calls are complete. Are you sure all the emails were sent when it was removed ?
>>
>>P.S Ignore the update to my last post. As you found the SendCompletedCallback will fire whether it is static or not.
>
>You're right, just less than half were sent. So do I need to make my PostAWBs asynchronous too? How?

If you're on .NET 4 then it's quite a bit more work than 4.5 which has the 'await' pattern :-{

See this link : http://msdn.microsoft.com/en-us/library/2e08f6yc(v=vs.100).aspx
You'd need to use the last (most complicated :{ ) version : 'Execute a callback when an asynchronous call completes'.

(or move to 4.5 :-} )
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform