4

Tried every possible setting found on stackoverflow and the Internet but no luck. Wish the developer of ELMAH had insight to show messages from ELMAH itself. ELMAH xml logging works fine.

Hope someone here will point out misconfiguration in web.config

<configSections>
    <sectionGroup name="elmah">
      <section name="security" requirePermission="false" type="Elmah.SecuritySectionHandler, Elmah" />
      <section name="errorLog" requirePermission="false" type="Elmah.ErrorLogSectionHandler, Elmah" />
      <section name="errorMail" requirePermission="false" type="Elmah.ErrorMailSectionHandler, Elmah" />
     <section name="errorFilter" requirePermission="false" type="Elmah.ErrorFilterSectionHandler, Elmah" /> 
    </sectionGroup>

</configSections>


<modules runAllManagedModulesForAllRequests="true">
  <remove name="ErrorLog" />
  <remove name="ErrorMail" />
  <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
  <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" preCondition="managedHandler" />
</modules>

<errorMail from="from email" to="to email" subject="elmah exception" smtpServer="smtp.gmail.com" port="587" userName="xxxx@gmail.com" password="gmailpassword" useSsl="true" async="true"  >
</errorMail>

Have tried user name without @gmail. Have tried locally installed server in errorMail settings but no help. The locally installed server works fine otherwise.

Have also tried this:

<system.net> 
    <mailSettings> 
      <smtp deliveryMethod="Network"> 
        <network host="smtp.gmail.com" port="587" userName="xxxxxxxxxxx" password="xxxxx" /> 
      </smtp> 
    </mailSettings> 
</system.net>

used these settings for local smtp server:

<errorMail from="from email" to="to email" subject="elmah exception" smtpServer="xxx IP address of smtpserver" port="25" userName="xxxxx" password="xxxx" async="true"  >
</errorMail>

All in all, I have tried all combinations, different settings, different SMTP servers.... no luck. Don't know if there is some message somewhere from ELMAH that I can see to know why ELMAH not connecting to STMP.

As stated above, I went through every post on this site that talks about ELMAH email and followed the instructions... but still couldn't make it work.

Also tried local smtp pickup directory

<smtp deliveryMethod="specifiedPickupDirectory">
        <specifiedPickupDirectory pickupDirectoryLocation="C:\inetpub\mailroot\Pickup"  />
      </smtp>

and monitored the directory. Saw no activity in the folder.

Using ELMAH 1.2

4

1 回答 1

0

本文解释了如何捕获 ELMAH 的内部错误:http: //ericmbarnard.blogspot.co.uk/2012/07/debugging-elmah-on-azure.html

几分钟前它告诉我为什么我的 SQL 日志记录不起作用,从而救了我 :-) 虽然它提到了 Azure,但您可以在本地调试中使用相同的技术,并且您将能够写入调试跟踪侦听器并避免写入数据库。

于 2013-10-06T19:50:23.567 回答