2011-04-06 10 views
7

대상 컴퓨터가 적극적으로 거부했기 때문에 연결할 수 없습니다. 127.0.0.1:25 설명 : 현재 웹 요청을 실행하는 동안 처리되지 않은 예외가 발생했습니다. 오류 및 코드에서 시작된 위치에 대한 자세한 정보는 스택 추적을 검토하십시오.SMTP 전자 메일 보내기

Exception Details: System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:25

소스 오류 :

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[SocketException (0x274d): No connection could be made because the target machine actively refused it 127.0.0.1:25] System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) +239
System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP) +35
System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception) +224

[WebException: Unable to connect to the remote server]
System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket6, Int32 timeout) +5483819
System.Net.PooledStream.Activate(Object owningObject, Boolean async, Int32 timeout, GeneralAsyncDelegate asyncCallback) +202
System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate asyncCallback) +21
System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDelegate asyncCallback, Int32 creationTimeout) +332 System.Net.Mail.SmtpConnection.GetConnection(String host, Int32 port) +160
System.Net.Mail.SmtpTransport.GetConnection(String host, Int32 port) +159
System.Net.Mail.SmtpClient.GetConnection() +35 System.Net.Mail.SmtpClient.Send(MailMessage message) +1213

[SmtpException: Failure sending mail.] System.Net.Mail.SmtpClient.Send(MailMessage message) +1531
Checkout.btnSend_Click(Object sender, EventArgs e) +2675
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
I can't send email in live connection but in my local its working.

나에게 사람들을 도와주세요.

System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565

버전 정보 : Microsoft .NET Framework 버전 : 2.0.50727.3615; ASP.NET 버전 : 2.0.50727.3618

여기 .. ​​내 C# 코드의

 SmtpClient SmtpMail = new SmtpClient(); 
     SmtpMail.Host = "localhost"; 

     //delete session cookie 
     Response.Cookies["session"].Expires = DateTime.Now.AddYears(-30); 

     SmtpMail.Send(objEmail); 
+2

컴퓨터에 메일 서버가 있습니까? 'telnet localhost 25'을 시도 했습니까? –

+0

어떤 SMTP 서버를 사용하고 있습니까? –

+0

... (windows) 방화벽을 확인하는 것을 잊지 마십시오 ... – m0sa

답변

14

당신은

당신이없는 말하지 마십시오 해당 컴퓨터에 SMTP 서버를 시작하는 것을 잊었다 해당 컴퓨터의 SMTP 서버. 그러나이를 알려야한다면 pagethis 페이지도 참조하십시오.

로컬 SMTP 서버를 구성하더라도 스팸 폴더에 이메일이 저장 될 가능성이 큽니다. 이메일 제공 업체의 SMTP 서버를 사용하는 것이 좋습니다. Gmail을 사용하고 있다면 here

+0

그래도 내 경우 SMTP 서버가 켜져 있고 기능적 임에도 불구하고 SMTP 서비스가 켜져 있음에도 불구하고 이와 동일한 127.0.0.1:25 오류가 발생합니다. 이전에는 작동했지만 일시적으로 보안 설정 변경 (SMTP의 설정이 아님)으로 인해 중단되었습니다. – Dexter