C# + VS2005 + SmtpClient not working on Win 64 2k3

dotnetnewbie1

Newcomer
Joined
Jun 3, 2008
Messages
2
Hi,

I had some code that sent a simple email using SmtpClient in C# + VS 2005.

We've now upgraded that server to the 64 bit version, and a simple test using SmtpClient fails.

I've confirmed that:
1. the same .exe works successfully from a 32 bit machine
2. the 64 bit server can ping the mail server dns alias successfully.

Any ideas why this wouldn't be working on the 64 bit machine?


Below is the error when run from a command prompt.

Unhandled Exception: System.Net.Mail.SmtpException: Failure sending mail. ---> S
ystem.Net.WebException: Unable to connect to the remote server ---> System.Net.S
ockets.SocketException: No connection could be made because the target machine a
ctively refused it
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddre
ss socketAddress)
at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Sock
et s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state,
IAsyncResult asyncResult, Int32 timeout, Exception& exception)
--- End of inner exception stack trace ---
at System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object ow
ner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket
6, Int32 timeout)
at System.Net.PooledStream.Activate(Object owningObject, Boolean async, Int32
timeout, GeneralAsyncDelegate asyncCallback)
at System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate
asyncCallback)
at System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncD
elegate asyncCallback, Int32 creationTimeout)
at System.Net.Mail.SmtpConnection.GetConnection(String host, Int32 port)
at System.Net.Mail.SmtpClient.Send(MailMessage message)
--- End of inner exception stack trace ---
at System.Net.Mail.SmtpClient.Send(MailMessage message)
at Mail.Application.simpleText()
 
@PlausiblyDamp

What exactly do you mean by "configured"?

If you mean SmtpClient is being given the appropriate mail host, then yes

e.g.
SmtpClient client = new SmtpClient("my mail server that works when run on win32 os");
 
If it is the same .exe then it is probably down to the OS configuration - can you telnet into the mail server from the 64bit OS? If not I would check the firewall configuration to see if it is allowing access out on the correct port.
 
Back
Top