Threads inside a foreach loop in c#

前端 未结 8 1551
粉色の甜心
粉色の甜心 2020-12-31 23:52

Hai guys,

I had the following code to send different mails to differnt users in my asp.net web application

foreach (DataRow dataRow in dataTable.Rows         


        
8条回答
  •  萌比男神i
    2021-01-01 00:01

    Thread per email is not the best idea as explained why by many, however in case you decided to create one background thread to handle all emails, the thread run time will be limited to 110 seconds. ASP.NET limits thread execution by default to 110 seconds in .NET 2.0. http://msdn.microsoft.com/en-us/library/e1f13641(v=vs.80).aspx

    Creating a queue - as suggested by others in earlier replies - is more sensible and scalable.

    http://msdn.microsoft.com/en-us/library/system.web.configuration.httpruntimesection.executiontimeout.aspx

提交回复
热议问题