No connection could be made because the target machine actively refused it:xxx.xxx.xxx.xxx:xx
问题是这样的,我在做一个smtpclient的测试,具体内容是一个网页上面点一个按钮之后向我自己的邮箱发一个邮件这样
web.config里面设置的smtp是一个hosting的smtp,发送方式是network
我在本机架构服务器,然后运行这个application,点击按钮后能给正常发给我的邮箱
然后我上传整个application上服务器,注意,这个服务器和smtp是同一个,用的登录帐号和密码跟本机测试的完全一样,web.config里面的一切设置都没有变。遗憾的是当我请求远程服务器的文件时,点击按钮却出现如上错误具体信息如下
 No connection could be made because the target machine actively refused it xxx.xxx.xxx.xxx:xx
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.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it xxx.xxx.xxx.xxx:xxSource 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.Stack Trace:[SocketException (0x274d): No connection could be made because the target machine actively refused it 127.0.0.1:587]
   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) +5421675
   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
   testMail._Default.bt_Click(Object sender, EventArgs e) in E:\My Documents\Visual Studio 2008\Projects\testMail\testMail\Default.aspx.cs:55
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
   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) +15651.这个问题原因是在哪里?如果是对方服务器的问题,我在程序编写时有没办法修正?
2.假设对方服务器有自己的smtp,如何通过配置调用该服务的smtp?也就是相对来说,调用本地smtp。因为对方服务器是hosting service,就是出租服务器的那种
3.除了.net,能否用asp或其他旧技术代替,用以发送邮件?不胜感谢