asp.net-mvc-3 – 如何在本地测试时禁用elmah发送电子邮件?
发布时间:2020-09-01 10:02:38 所属栏目:asp.Net 来源:互联网
导读:当我们将以下行添加到web.config时 – add name=ErrorMail type=Elmah.ErrorMailModule, Elmah / Elmah发送有关正在发生的任何异常的电子邮件.但我们希望这只发生在Web服务器上部署的实时站点.而不是当我们在我们的机器上本地测试网站时.当前它正在这样做并在
当我们将以下行添加到web.config时 – <add name="ErrorMail" type="Elmah.ErrorMailModule,Elmah" /> Elmah发送有关正在发生的任何异常的电子邮件.但我们希望这只发生在Web服务器上部署的实时站点.而不是当我们在我们的机器上本地测试网站时.当前它正在这样做并在我们在本地测试网站时发送电子邮件.有谁知道我们如何配置它? 解决方法将电子邮件日志记录添加到Web.Release.config.我的基础Web.config根本不包含任何Elmah东西 – 在使用release进行编译时都会添加它们.如果您编译发布并在本地运行,它将通过电子邮件发送和登录,但常规调试版本不会.Web.Release.config <configSections> <sectionGroup name="elmah" xdt:Transform="Insert"> <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> <connectionStrings> <clear/> <add xdt:Transform="Insert" name="ErrorLogs" connectionString="...." /> </connectionStrings> <elmah xdt:Transform="Insert"> <errorLog type="Elmah.SqlErrorLog,Elmah" connectionStringName="ErrorLogs" /> <security allowRemoteAccess="0" /> <errorMail ...Email options ... /> </elmah> <system.web> <compilation xdt:Transform="RemoveAttributes(debug)" /> <httpModules xdt:Transform="Insert"> <add name="ErrorLog" type="Elmah.ErrorLogModule,Elmah" /> <add name="ErrorMail" type="Elmah.ErrorMailModule,Elmah" /> </httpModules> </system.web> <system.webServer> <modules xdt:Transform="Insert" runAllManagedModulesForAllRequests="true"> <add name="ErrorLog" type="Elmah.ErrorLogModule,Elmah" /> </modules> </system.webServer> </configuration> 最后,请注意您的基本Web.config应该具有< configSections>标记在开头,即使它是空的: Web.config文件 <configuration> <configSections /><!-- Placeholder for the release to insert into --> .... (编辑:百色站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net – Javascript日期本地化
- asp.net-mvc – 访问ASP.NET MVC应用程序中的控制器/操作列
- ASP.NET MVC下Ajax.BeginForm方式无刷新提交表单实例
- 我如何让Fiddler捕获我的MVC应用程序向我的ASP.NET Web API
- asp.net-mvc – Mvc 3 Razor:使用部分部分视图?
- 使用ASP.NET AJAX Control Toolkit设置焦点
- ASP.NET对大文件上传的解决方案
- asp.net-mvc – ASP.Net [HiddenInput]数据属性在Razor中用
- 并行运行ASP.NET Webforms和ASP.NET MVC
- asp.net – 脚本标签和链接标签进入asp:内容或外部
推荐文章
站长推荐
- asp.net-mvc – 允许asp.net mvc 2控制器名称的U
- WCF服务与ASP.NET Web Api
- asp.net – 将web应用程序的项目编译成dll
- 无法通过IP地址连接ASP.NET开发服务器(VS2010)
- asp.net – 从多个Web.config文件访问appSetting
- asp.net-mvc – 不要在ASP .NET MVC 4 BundleCon
- asp.net – Umbraco CMS(.NET):加载xslt /用户控
- 为熟悉ASP.NET Web表单开发的人建议MVC3的周末学
- asp.net-mvc – 用于选择的KendoUI网格Ajax绑定参
- 什么是使用aspnet_compiler.exe预编译ASP.NET项目
热点阅读