asp.net – 无法为Elmah配置邮件
发布时间:2020-12-16 03:36:58 所属栏目:asp.Net 来源:网络整理
导读:我有以下配置文件片段 configSections sectionGroup name="elmah" section name="security" requirePermission="false" type="Elmah.SecuritySectionHandler,Elmah" / section name="errorLog" requirePermission="false" type="Elmah.ErrorLogSectionHandle
我有以下配置文件片段
<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> <mailSettings> <smtp deliveryMethod="Network"> <network host="smtp.gmail.com" port="587" userName="example@gmail.com" password="password" /> </smtp> </mailSettings> </system.net> <elmah> <errorMail from="example1@gmail.com" to="example2@gmail.com" sync="true" smtpPort="0" useSsl="true" /> </elmah> 我用适当的东西替换了example1等.现在,我有以下问题: – 解决方法
试试这个:
<?xml version="1.0"?> <configuration> <configSections> <!--ELMAH--> <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> <elmah> <security allowRemoteAccess="1"/> <!-- set the smtpPort attribute to "0". Doing so will cause ELMAH to use the port defined per the <system.net> settings --> <errorMail from="example1@gmail.com" to="example2@gmail.com" subject="ERROR(test):" async="false" smtpPort="0" useSsl="true" /> </elmah> <!--System.net Mail setup--> <system.net> <mailSettings> <smtp deliveryMethod="network"> <network host="smtp.gmail.com" port="587" userName="example1@gmail.com" password="..." /> </smtp> </mailSettings> </system.net> <appSettings> ... </appSettings> <connectionStrings> ... </connectionStrings> <system.web> <compilation debug="true"> <assemblies> ... </compilation> <customErrors mode="Off"/> ... <httpHandlers> ... <!--ELMAH--> <add verb="POST,GET,HEAD" path="MyErrorPage/elmah.axd" type="Elmah.ErrorLogPageFactory,Elmah"/> </httpHandlers> <httpModules> ... <!-- ELMAH: Logging module --> <add name="ErrorMail" type="Elmah.ErrorMailModule,Elmah"/> <!-- <add name="ErrorLog" type="Elmah.ErrorLogModule,Elmah"/> --> <!--<add name="ErrorFilter" type="Elmah.ErrorFilterModule,Elmah"/>--> </httpModules> <httpRuntime maxRequestLength="458292"/> <authentication mode="Forms"> ... </authentication> ... </system.web> <location path="MyErrorPage.aspx"> <system.web> <authorization> <allow users="?"/> </authorization> </system.web> </location> <!-- The system.webServer section is required for running ASP.NET AJAX under Internet Information Services 7.0. It is not necessary for previous version of IIS. --> <system.webServer> <validation validateIntegratedModeConfiguration="false"/> <modules runAllManagedModulesForAllRequests="true"> ... <!-- ELMAH--> <add name="ErrorLog" type="Elmah.ErrorLogModule,Elmah"/> <add name="ErrorMail" type="Elmah.ErrorMailModule,Elmah"/> <add name="ErrorFilter" type="Elmah.ErrorFilterModule,Elmah"/> </modules> <handlers> ... <!--ELMAH--> <add name="Elmah" verb="POST,Elmah"/> </handlers> </system.webServer> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> ... </assemblyBinding> </runtime> <location path="MyErrorPage/elmah.axd"> <system.web> <authorization> <deny users="?"/> <allow users="?"/> </authorization> </system.web> </location> </configuration> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net-core – AppSettings.*.json文件未在ASP.NET CORE
- asp.net – 匿名类型列表
- 关于Type Initializer和 BeforeFieldInit的问题,看看大家能
- asp.net – 获取Gridview中隐藏列的值
- asp.net-core – 如何在Asp.net Core中使用soap web服务?
- asp.net-mvc – MVC4上的服务堆栈
- asp.net核心 – Asp.Net核心从url获取RouteData值
- asp.net – SQL Server用户定义的表类型和.NET
- 如何确定使用32位与64位ASP.NET?
- asp.net-mvc – ASP.NET MVC3 IIS7.5:Cache-Control maxag
推荐文章
站长推荐
热点阅读