2013-03-08 73 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证书解决问题的工作。

相关问题