相关疑难解决方法(0)

发送电子邮件给Elmah?

有人使用Elmah通过电子邮件发送例外吗?我已经通过SQL Server设置了Elmah日志记录,并且可以通过Elmah.axd页面查看错误页面,但我无法使电子邮件组件正常工作.这里的想法是获取电子邮件通知,以便我们可以更快地对异常做出反应.这是我的web.config(省略了不必要的部分),所有敏感数据都被***取代.即使我指定要连接的服务器,SMTP服务是否需要在本地计算机上运行?

<?xml version="1.0"?>
<configuration>
    <configSections>
        <sectionGroup name="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>
    <appSettings/>
    <connectionStrings>
        <add name="elmah-sql" connectionString="Data Source=***;Initial Catalog=***;Persist Security Info=True;User ID=***;Password=***" />
    </connectionStrings>

    <elmah>
        <errorLog type="Elmah.SqlErrorLog, Elmah" connectionStringName="elmah-sql"   >
        </errorLog>
        <errorMail from="test@test.com"
           to="test@test.com"
           subject="Application Exception"
           async="false"
           smtpPort="25"
           smtpServer="***"
           userName="***"
           password="***">
        </errorMail>
    </elmah>

    <system.web>        
        <customErrors mode="RemoteOnly" defaultRedirect="CustomError.aspx">
            <error statusCode="403" redirect="NotAuthorized.aspx" />
            <!--<error statusCode="404" redirect="FileNotFound.htm" />-->
        </customErrors>
        <httpHandlers>
            <remove verb="*" path="*.asmx"/>
            <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, …
Run Code Online (Sandbox Code Playgroud)

.net asp.net elmah

87
推荐指数
3
解决办法
3万
查看次数

标签 统计

.net ×1

asp.net ×1

elmah ×1