Using System.Net.Mail.SendAsync at the same time?

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

+3
source share
1 answer

One instance SmtpClientcan only start one asynchronous call at a time. You must create multiple clients if you want to make several asynchronous calls.

Since different threads have their own instance SmtpClient, they do not collide.

+3
source

Source: https://habr.com/ru/post/1742619/


All Articles