System.Exception: System.Web.HttpException: The transport failed to connect to the server. System.Runtime.InteropServices.COMException (0x80040213): The transport failed to connect to the server.

I have an application which creates about 50 XML packages and sends a notification about the success/failure of every package. I am running this code in threads and I have restricted maximum no. of threads that can be active at any time to 2.So the package generation and the notification would be performed for 2 packages in parallal.

But while sending notifications to users, I am getting the below error only for very few packages[ 1 or 2 out of 50] . The same base code is used by all the packages but i am getting this error intermittently.

System.Exception: Error sending mail to [SomeOne@SomeThing.com]: System.Web.HttpException: The transport failed to connect to the server. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException (0x80040213): The transport failed to connect to the server. --- at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters) at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams) at System.Web.Mail.SmtpMail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args) at System.Web.Mail.SmtpMail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args) at System.Web.Mail.SmtpMail.CdoSysHelper.Send(MailMessage message) at System.Web.Mail.SmtpMail.Send(MailMessage message)

 

Verion information: MS ASP.NET 2.0 .

I am posting excerpt of the code that sends the notification.

using System.Web.Mail;

       string strFullBody = string.Empty;
      if (HtmlFilePath != null)
      {
        try
        {
          using (StreamReader reader=new StreamReader(this.HtmlFilePath))
          {     
            strFullBody = strWelcome;
            strFullBody += reader.ReadToEnd(); 
            strFullBody += strSignature;
          } 
        }
        catch(Exception ex)
        {
          throw new Exception("error reading HTML File -> [" + HtmlFilePath + "]");
        }
      }
      else
      {
        strFullBody = strWelcome + strBody + strSignature;
      }
      try
      {
        MailMessage Message = new MailMessage();
        Message.BodyFormat= MailFormat.Html;
        Message.To = emailAddress;
        Message.From =  this.FromEmail;
        Message.Subject = this.Subject;
        Message.Body = strFullBody;          
        Message.Priority = _Urgent?System.Web.Mail.MailPriority.High:System.Web.Mail.MailPriority.Normal;
// Actually we will pass the smtp server name to this code.

// ApplicationSettings.Parameters["SMTPServer"].Value.ToString()

        SmtpMail.SmtpServer =  this.SmtpServer;  


        // Add Attachments
        foreach (string f in _Attachments)
        {
          MailAttachment attach = new MailAttachment(f);
          Message.Attachments.Add(attach);
        }
        SmtpMail.Send(Message);
      }
      catch(Exception ex)
      {
        throw new Exception("Error sending mail to [" + emailAddress + "]: " + ex.ToString());         
//        return false;
      }
      return true;
    } 

 

I have checked all possible areas. Authentication was anonymous. Relaying was allowed for the local computer. And the more panicky is could not reproduce it from local. Whether it's happening really because there is any network issue while accessing the SMTPServer or there's some thing with the code? Please throw some light on this issue and provide your valuable thoughts.

 

-- Sateesh


--Sateesh
0
SateeshP
10/20/2008 8:55:58 PM
asp.net.getting-started 91979 articles. 3 followers. Follow

0 Replies
1634 Views

Similar Articles

[PageSpeed] 56

Reply:

Similar Artilces:

System.web.mail gmail error: System.Web.HttpException: The transport failed to connect to the server
Hello there, Im using VWD2008 and sql server express for the development of my school project..I have an application which could send newsletter to subscribed user, but i get this error upon sending the mail: A general exception occurred! System.Web.HttpException: The transport failed to connect to the server. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException (0x80040213): The transport failed to connect to the server. --- End of inner exception stack trace --- at System.Runtim...

Help me : Exception Details: System.Runtime.InteropServices.COMException: The transport failed to connect to the server.
Hello Friend, Hi, and welcome to the ASP.NET forums. You can find a great FAQ on this site: http://www.systemwebmail.com/ Grz, Kris.Read my blog. Handy Firefox plugins for web developers.Workaround for non working Mark as answer buttons....

System.Web.Mail "The transport failed to connect to the server"
I have been trying to get this email form working all night.  I just moved my site to a new server and now my forms do not work.  <% @Import Namespace="System.Web.Mail" %><script language="vb" runat="server"> Sub btnSendFeedback_Click(sender as Object, e as EventArgs)   'Create an instance of the MailMessage class  Dim mail as New MailMessage()   'Set the properties - send the email to the person who filled out the  'feedback form.  mail.To = "info@mydomain.com"  mail.From = txtEmail.Text   'If you want to CC this email to someon...

Custom tool error: "Code generator 'ReportCodeGenerator' failed. Exception stack = System.Exception: Load report failed. ---> System.Runtime.InteropServices.COMException (0x800001FD):
The tool which generates the class file for the crystal report files throws this error for a particular report. this is the error C:\MRPS\MRPSWEB\Reports\AuditForm.rpt(1): Custom tool error: "Code generator 'ReportCodeGenerator' failed.  Exception stack = System.Exception: Load report failed. ---> System.Runtime.InteropServices.COMException (0x800001FD): Invalid field name.   at CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.Open(Object& DocumentPath, Int32 Options)   at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.Open(...

The transport failed to connect to the server and System.UnauthorizedAccessException: Access is denied.
Dear Friends, I am very new to setting up website, especially using IIS7 and Windows Server 2008. We have a web application in which one of the form is suppose to send email to a client/Administrator when data is being saved. There are problems that we face with this particular functionality. Environment: Windows Server 2008, SQL Server 2005, .Net Framework 2.0, 3.5. The first problem is that when we have the settings in web.config file as follow: <add key="SMTP.IpAddress" value="192.168.1.249"/>    <add key="ServerIP&q...

System.Runtime.InteropServices.COMException: Server execution failed
Hi, I am creating powerpoint slide on server through asp.net, and giving a download option for it. Some it's work fine, But Some times it giving a server error - System.Runtime.InteropServices.COMException: Server execution failed  Please help ...........Best Of Luck ............

system.runtime.interopservices.comexception server execution failed
hi experts am creating a chart in powerpoint. chart is creating but some times there occure a error .i have added references - Microsoft office 10.0 Object Library,Microsoft PowerPoint 10.0 Object Library. what more i need to do for remove error . error is like this- server error in '/'Application. server execution failed system.runtime.interopservices.comexception server execution failed am using this code  pptApp1 = New Microsoft.Office.Interop.PowerPoint.Application  pptPres1 = pptApp1.Presentations.Add  pptSlide = pptPres1.Slides.Add(1, PpSlideLayout.ppLayou...

System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: Only one usage of each socket address (protocol/network address/port) is normally permitted
I'm getting this error when hitting a webservice thousands of times for a mass upload. I've researched on the web and added the suggested code but am still getting the error: protected override WebRequest GetWebRequest(Uri uri) { System.Net.HttpWebRequest webRequest = (System.Net.HttpWebRequest)base.GetWebRequest(uri); webRequest.KeepAlive = false; return webRequest; }  Are you receiving it on the client, or on the service?John Saunders | MVP – Connected System Developer...

2008 IIS7 connection to SQL Server 2000 on Web Server 2000: Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.
I am setting up a windows 2008 IIS7 web server, and trying to connect to a windows 2000 sql server 2000 database. I have an IIS6 Windows 2000 web server activately connected just fine. I have anonymous and windows authentication enabled. And in my web.config I have identity impersonate="true" My sql server 2000 typically uses the IISUSER anonymous user set up in IIS6 on my original windows 2000 web server. But this new IIS7 is giving me grief. I can't seem to setup the IUSR or IISUSER or anything in it. I can't even use sql server credentials in my connection string altho...

Help solving exception of type 'System.Runtime.InteropServices.ExternalException' in System.Drawing.dll in Windows server 2003
Hi,I am developin g an web application in which png files are created from pdf files. the platform is VS.Net 2005 and  .Net framework 2.  I get this below error message when JIT debugging is enabled."An unhandled exception of type 'System.Runtime.InteropServices.ExternalException' occurred in System.Drawing.dll. I faced this error while running the exe in Windows server 2003 Standard edition SP1 whereas while trying in windows 2000 service pack 4, this error cannot be reproduced. I think this is operation system issue with Windows server 2003 Standard edition SP1....

i ve got System.Security.SecurityException: Request for the permission of type 'System.Net.Mail.SmtpPermission, System, Version=2.0.0.0, failed. exception
hi everyone i created windows form user control and i embedded it to asp.net web for , my user control sends mail using by System.Net.Mail library but when i open my web site and click to send button that on my user control  i ve got this exception System.Security.SecurityException: Request for the permission of type 'System.Net.Mail.SmtpPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.    what can i do ? my best regards ..    Couple of questions: 1) Are you running this from an IIS installati...

The Transport failed to connect to the server.
I am using ASP.NET & C# and SQL server 2000 as backendIf net connection goes in our company then, our coding is not working bcoz in our coding we r sending email .thats why "sending email" part is not work if net connection gone.and we get following error :COMException: The Transport failed to connect to the server.So, how to catch this type of error....

The transport failed to connect to the server.
I get the following error when I try to submit an email from a vb web form. The code for the submit email button follows the error.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.Runtime.InteropServices.COMException: The transport failed to connect to the server. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of t...

The transport failed to connect to the server
Hi I m using system.web.mail namespace for sening a mail in my application .i m using vb.net 2005..i set all parameter for smtp server but i m getting an error : The transport failed to connect to the server my code  :- Dim client As System.Web.Mail.MailMessage = New System.Web.Mail.MailMessage client.To = txtemail.Text client.From = "Support@abc.com" client.Subject = "Test Mail" client.Body = "hello "client.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserver", "servername") ' set SMTP server portclient.Fi...

Web resources about - System.Exception: System.Web.HttpException: The transport failed to connect to the server. System.Runtime.InteropServices.COMException (0x80040213): The transport failed to connect to the server. - asp.net.getting-started

Mono (software) - Wikipedia, the free encyclopedia
Mono is a free and open source project led by Xamarin (formerly by Novell and originally by Ximian ) to create an Ecma standard compliant .NET ...

Watermarked edit controls
... using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Runtime.InteropServices; ...

How to pass arrays of objects from C# to C++
... code in the same file, but you can put them in different files. Here is an abbreviated sample: using System; using System.Runtime.InteropServices; ...

Mach3 Control via C# Winform Application
This demo app allows the user to send Gcode commands to Mach 3 to control a CNC mill, lathe or other cnc hardware. The application was made ...

.NET Streams and Windows 8 IStreams
November 8, 2011 New York, N.Y. I am currently engaged in writing an EPUB viewer for Windows 8. EPUB is a popular format for electronic books. ...

Singularity RDK - Source Code
Experimental verified OS

Top Ranked Articles
Top Ranked Articles - Free source code and tutorials for Software developers and Architects.; Updated: 23 Feb 2013

You, Me, and .NET GUIDs
Research done here at CylanceSPEAR is not limited to vulnerabilities. For instance, in the following research I describe two GUIDs that can be ...

One small step for native code; one big leap for Windows Phone 7 jailbreak
Just weeks after the launch of Windows Phone 7 around the world, the inevitable attempts to jailbreak the operating system is yielding some interesting ...

My current preferred continuous integration build script–psake
... global:create-commonAssemblyInfo($version,$applicationName,$filename) { "using System; using System.Reflection; using System.Runtime.InteropServices; ...

Resources last updated: 2/4/2016 1:38:47 PM