2011-11-28 2 views
0

내 서버에서 응용 프로그램을 호스팅하고 있습니다. 이 응용 프로그램은 전자 메일을 사용자 목록에 보냅니다. 목록에 10000 명의 사용자가 있다고 가정 해 보겠습니다. 나는 목록을 세 부분으로 나누고 각 부분을 전자 메일을 보내기위한 별도의 스레드에 할당합니다. 문제는 내가 서버에 가서 내 응용 프로그램을 호스팅하고 응용 프로그램을 실행할 때 내가 만든 모든 3 개의 목록에 전자 메일을 보냅니다. 하지만 내 로컬 PC에서 응용 프로그램을 원격으로 탐색 할 때입니다. 이메일은 전송되지 않습니다.asp.net의 멀티 스레딩 문제

누구든지 문제를 해결하고 해결 방법을 알려줄 수 있습니다. 사전에

감사 관련

+0

오류가 있습니까? –

+1

어쩌면 당신은 smtp를 정의 할 필요가 있을까요? –

+0

오류, 스크린 샷, 코드? 더 나은 시나리오를 설명하십시오. –

답변

0

안녕하세요 여기에 코드입니다.

# region /////Split Users List in 3 Parts//// 
       ArrayList thList1 = new ArrayList(); 
       ArrayList thList2 = new ArrayList(); 
       ArrayList thList3 = new ArrayList(); 
       ArrayList thListId1 = new ArrayList(); 
       ArrayList thListId2 = new ArrayList(); 
       ArrayList thListId3 = new ArrayList(); 
       int countList = arlistuid.Count/3; 
       int count; 
       for (count = 0; count < arlistuid.Count; count++) 
       { 
        if (count < countList) 
        { 
         thList1.Add(arlistuid[count]); 
         thListId1.Add(arlistid[count]); 
        } 
        else if (count >= countList && (count < countList + countList)) 
        { 
         thList2.Add(arlistuid[count]); 
         thListId2.Add(arlistid[count]); 
        } 
        else 
        { 
         thList3.Add(arlistuid[count]); 
         thListId3.Add(arlistid[count]); 
        } 

       } 

       # endregion 

       # region ///Send Email using 3 threads 
       if (thList1.Count > 0) 
       { 
        object thdargs = new object[2] { thList1, thListId1 }; 
        Thread thd1 = new Thread(new ParameterizedThreadStart(SplitListEmail)); 
        thd1.IsBackground = true; 
        thd1.Name = "Thread1"; 
        thd1.Start(thdargs); 
       } 
       if (thList2.Count > 0) 
       { 
        object thd2args = new object[2] { thList2, thListId2 }; 
        Thread thd2 = new Thread(new ParameterizedThreadStart(SplitListEmail)); 
        thd2.IsBackground = true; 
        thd2.Name = "Thread2"; 
        thd2.Start(thd2args); 
       } 
       if (thList3.Count > 0) 
       { 
        object thd3args = new object[2] { thList3, thListId3 }; 
        Thread thd3 = new Thread(new ParameterizedThreadStart(SplitListEmail)); 
        thd3.IsBackground = true; 
        thd3.Name = "Thread3"; 
        thd3.Start(thd3args); 
       } 
       # endregion