views:

30

answers:

1

I want to use System.Net.Mail.SendAync in an ASP.NET MVC2 application. I see that it throws an InvalidOperationException if there is already a SendAsync call in progress. Does this mean only one SendAsync is allowed per host, or per thread? For example, if I simultaneously have 2 web users from 2 different remote hosts, can each use SendAsync at the same time?

+2  A: 

One instance of SmtpClient can only run one asynchronous call at a time. You have to create several clients if you want to run several asynchronous calls.

As different threads have their own instance of SmtpClient, they don't collide.

Guffa