Probando los diferentes tipos de Sinks de la versión 1.0 de Enterprise Library, me encontré con un error al momento de querer guardar los errores en formato EMail.

Recordemos que los formatos que soporta por defecto son:

  • EventLog: el clásico. Si hay muchas excepciones queda bastante poco prolijo. Especialmente, si no hemos creado un EventLog en particular para este Sink, por defecto lo guarda en el Application.
  • FlatFile: Mucho mas manuable, pero tiene a crecer indefinidamente y luego se hace difícil comprenderlo.
  • Message Queue: una de las mejores opciones, los mensajes quedan en una cola de mensajes y luego los puedo procesar por mi cuenta.
  • EMail: Otra de las opciones interesantes, ya que una configuración para los errores críticos a través de mails, logra un muy buen impacto a nivel administración
  • DataBase: EntLib viene con una pequeña Base de Datos que permite almacenar con gran detalle todos los mensajes.

Mi problema en particular fue configurando la opción para EMail. A través de la herramienta de configuración el Sink del tipo EMail quedaba con la siguiente configuración:

<sink

xsi:type="EmailSinkData"

name="Email Sink"

toAddress="JoseMadrid@bruno.com"

fromAddress="error@bruno.com"

subjectLineStarter="Error Line Starter"

subjectLineEnder="Error from Server"

smtpServer="127.0.0.1" />

Sin embargo al momento de invocarlo, EntLib generaba un error y lo almacenada en el EventLog:

An error occurred while the Distributor was processing the message.  Please check your configuration files for errors or typos.  Verify that your sinks are reachable (queues exist, permissions are set, database exists, etc…)

 

Sink failed because: System.Web.HttpException: Could not access ‘CDO.Message’ object. —> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. —> System.Runtime.InteropServices.COMException (0x8004020F): El servidor rechazó una o más direcciones de destinatarios. Respuesta del servidor: 550 5.7.1 Unable to relay for JoseMadrid@bruno.com

 

Buscando en Internet encontré la siguiente información que me permitió configurar correctamente el SMPT Server para que el proceso del IIS pueda tener acceso al mismo.

Suggestion 1
Specify a valid mail server for the SmtpMail.SmtpServer property. If that property is not set, at least set it to 127.0.0.1. For example:

SmtpMail.SmtpServer = "127.0.0.1"

Suggestion 2
If you are using "localhost" or "127.0.0.1" as the SmtpMail.SmtpServer, you may not have permissions to relay through the IIS SMTP Service. To allow access, open up the IIS Admin MMC. Locate the SMTP Virtual Server, and right-click, then select Properties. On the Access tab, click the Relay button. In the Relay Restrictions dialog, grant your IP address (127.0.0.1) to the Computers listbox. Close down all dialogs, and restart the SMTP Service.

Más à http://www.systemwebmail.com/faq/4.2.3.aspx

Pues bien el resultado final fue

Completamente contento con el funcionamiento de Enterprise Library.

Saludos

2 responses to “Enterprise Library – Logging EMail Sink (Error :S)”

  1. ola, me llamo Javi y me gustaría que me ayudaras con una duda sobre mi smtp.
    El tema es que estoy haciendo un portal b2e en vb.net y necesito enviar emails desde la web al administrador por ejemplo.
    El fallo creo que está en mi iis, ya sabes, en mi smtp virtual.
    La web intenta enviar el mail pero casca informándome de el siguiente error:
    "El servidor rechazó una o más direcciones de destinatarios. Respuesta del servidor: 550 5.7.1 Unable to relay for administrador@epersonalmail.dyndns.org"
    numero de error: 0x8004020f
    He leido lo que habías puesto en tu espacio acerca de cómo solucionarlo y he dado de alta mi dominio, además he estado tocando un poco la configuración intentando solucionarlo pero nada.
    Sabes que debo de hacer en concreto? Te lo agradecería mucho. Espero respuesta.
    Mi dirección de correo es javitxin25@hotmail.com.
    Gracias.

    Like

  2. Excelente articulo, me ayudó mucho.Gracias.

    Like

Leave a reply to javier Cancel reply

Discover more from El Bruno

Subscribe now to keep reading and get access to the full archive.

Continue reading