i have scenario, msmq queuing system...records queued on timely basis...a wcf listener listens queue, starts processing records records queued up...does process , sends email after that(there 10 queues , 10 listeners out of 3 listeners responsible email sending). problem facing email sending part, larger data queued records following error
service not available, closing transmission channel. server response was: 4.3.2 maximum number of concurrent connections has exceeded limit, closing transmission channel
the class sends email is
public class { //method static common method used other processes running in parallel public static void sendmail() { mailmessage mail = new mailmessage(); smtpclient client = new smtpclient(); ///email information goes here client.send(mail); } }
i guess method static smtp object instantiated each time causes problem. if increase concurrent connections not solving problem. have couple of workaround required more light on this.
- limit no. of concurrent connections let 100. have 1000 records queued , listeners starts processing them in parallel smtp process not use more 100 connections @ time, wait complete , take next 100 , on. not sure how this.
- use parallel foreach loop or smtpclient.sendasync method, here proficiency level not regarding these methods, little bit afraid(i need make sure there no major performance hit). needed stable , better approach solve this.
Comments
Post a Comment