ASP.NET: System.Net.Sockets.SocketException: Connection refused

Status
Not open for further replies.

fotoweb

New Member
Messages
3
Reaction score
0
Points
0
Hi all


i get the following error when i try to open the connection to mysql:

System.Net.Sockets.SocketException: Connection refused

U have the same problem sending a email with System.Net.Mail.SmtpClient

I'm using ASP.NET :dunno:

Thanks!
 
Last edited:

garrettroyce

Community Support
Community Support
Messages
5,609
Reaction score
252
Points
63
This is probably a better question for programming help as it's likely a programming error and not a server error.

Could you post some of the related code so that we can see what is happening?
 

fotoweb

New Member
Messages
3
Reaction score
0
Points
0
The code works fine in Windows. It's :

************************************************************
Dim LectorConfiguracion As New AppSettingsReader
Dim oSmtpClient As New System.Net.Mail.SmtpClient
Dim oMailMessage As New System.Net.Mail.MailMessage
Dim EmailHost As String = ""
Dim EmailFrom As String = ""
Dim EmailTo As String = ""
Dim EmailUser As String = ""
Dim EmailPasswd As String = ""

EmailHost = LectorConfiguracion.GetValue("EmailHost", EmailHost.GetType())
EmailFrom = LectorConfiguracion.GetValue("EmailFrom", EmailFrom.GetType())
EmailTo = LectorConfiguracion.GetValue("EmailTo", EmailTo.GetType())
EmailUser = LectorConfiguracion.GetValue("EmailUser", EmailUser.GetType())
EmailPasswd = LectorConfiguracion.GetValue("EmailPasswd", EmailPasswd.GetType())

oSmtpClient.Host = EmailHost
oSmtpClient.Port = 25
oSmtpClient.Credentials = New System.Net.NetworkCredential(EmailUser, EmailPasswd)

oMailMessage.From = New System.Net.Mail.MailAddress(EmailFrom)
oMailMessage.Subject = Subject
oMailMessage.To.Add(EmailTo)
oMailMessage.IsBodyHtml = False
oMailMessage.Priority = Net.Mail.MailPriority.Normal
oMailMessage.Body = Body

oSmtpClient.Send(oMailMessage)
************************************************************

The error happen in then line : oSmtpClient.Send(oMailMessage)
 

garrettroyce

Community Support
Community Support
Messages
5,609
Reaction score
252
Points
63
Hm. What's the value of

Code:
Dim EmailHost As String = ""

I'm assuming you're not using "" as your host ;)
 
Status
Not open for further replies.
Top