2013-03-08 70 views
0

我有一個簡單的腳本來發送MailMessage電子郵件。這可以工作併發送本地運行的電子郵件。然而,當部署到生產服務器我得到這個錯誤用mail.live.com發送郵件在生產服務器上失敗

Authentication failed because the remote party has closed the transport stream. 

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.IO.IOException: Authentication failed because the remote party has closed the transport stream. 

Source Error: 

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. 

郵碼:

try 
{ 
    SmtpClient smtp = new SmtpClient(); 
    smtp.EnableSsl = true; 
    smtp.DeliveryMethod = SmtpDeliveryMethod.Network; 
    smtp.Send(message); 
} 

catch (Exception ex) 
{ 
    throw ex; 
} 

配置設置:

<system.net> 
    <mailSettings> 
    <smtp from="[email protected]"> 
     <network host="smtp.live.com" password="password" port="587" userName="[email protected]" enableSsl="true"/> 
    </smtp> 
    </mailSettings> 
    </system.net> 

爲什麼它在生產中失敗,任何想法?

NB相同的代碼時使用的Gmail(改變端口和主機配置設置後)

+2

我認爲這是服務器上SSL證書的問題。查看是否[this](http://social.msdn.microsoft.com/Forums/en-US/ncl/thread/00f54d4f-5d83-4537-a222-128c89584737/)或[this](http:// social。 technet.microsoft.com/Forums/en-US/sharepointsearch/thread/b1ba71ec-499a-44a0-81de-6165c660b80a/)幫助... – Blachshma 2013-03-08 00:24:25

回答

0

上的Web服務器添加SSL證書解決問題的工作。

相關問題