asp.net-mvc-3 – 如何在本地测试时禁用elmah发送电子邮件?
发布时间:2020-09-01 09:51:46 所属栏目: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 --> .... (编辑:4S站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net – IIS 404自定义错误不能按预期工作
- asp.net-mvc – AntiXss保护Html模型属性
- asp.net – 经过身份验证的服务不支持跨域javascript回调.
- 实体框架 – 使用EF和WebAPI,如何返回一个ViewModel并支持I
- asp.net – 从我的GridView行返回一个对象
- LoginView中的ASP.NET LoginStatus不会触发LoggingOut事件
- asp.net-mvc – Url.RouteUrl返回null
- asp.net-mvc – ASP.net MVC DropDownList预选项目被忽略
- ASP.NET基于Ajax的Enter键提交问题分析
- asp.net – 如何在页面加载时以“添加新”模式进行编程设置
推荐文章
站长推荐
- asp.net-mvc – 为什么这个路由参数被添加到查询
- asp.net – Tridion分析和个性化错误:用户不能为
- asp.net-mvc – 使用asp.net mvc 2功能与火花浏览
- asp.net-mvc – 如何从剃刀视图访问My.Resources
- asp.net-mvc – 为什么ASP.NET MVC 4与IList for
- asp.net-mvc – 从视图到控制器POST信用卡数据是
- ASP.NET Response.Cache.SetNoStore()与Response
- ASP.NET Webforms,用户控件中的JavaScript
- ASP.NET汉字转拼音 - 输入汉字获取其拼音的具体实
- .net – CS0012:类型’System.Data.Linq.DataCo
热点阅读