title: System.Net.Sockets.SocketException: A system call has failed
body: <p>I have the following code snippet that run with IIS Express of VS2012. It is able to send out email and working fine with smtp server.
  Then deployed it as New Application on IIS 7. When I run it, I am getting the error “System.Net.Sockets.SocketException: A system call has failed 11.29.83.49:25” .</p>
  
  <p>Do you have any idea what causing the error? 
  Do I miss something to configure  IIS server to work with smtp server?</p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
  {
      System.Net.Mail.MailMessage _message = new System.Net.Mail.MailMessage();
      _message.Subject = "Hi Testing";
      _message.SubjectEncoding = System.Text.Encoding.UTF8;
      _message.From = new System.Net.Mail.MailAddress("sender@gmail.com","Test");        
      _message.To.Add(new System.Net.Mail.MailAddress("receiver@gmail.com", "Test"));
      System.Net.Mail.AlternateView _content_view = System.Net.Mail.AlternateView.CreateAlternateViewFromString("Message Body");
      _message.AlternateViews.Add(_content_view);
      sendEmailMessage(_message);
  }
  public void sendEmailMessage(System.Net.Mail.MailMessage message)
  {
      getClientFromConfig().Send(message);
  }
  private static System.Net.Mail.SmtpClient getClientFromConfig()
  {
      System.Net.Mail.SmtpClient _client = new System.Net.Mail.SmtpClient();
      _client.Host = "host name/ip here";
      _client.Port = 25;
      return _client;
  }   
  </code></pre>
  
  <p>Could anyone please suggest to get it work?</p>