asp.net-mvc-3 – 如何在本地测试时禁用elmah发送电子邮件?
发布时间:2020-09-08 12:40:19 所属栏目: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-mvc – 用于选择的KendoUI网格Ajax绑定参数
- asp.net-mvc – 在MVC ActionLink中使用Knockout绑定
- asp.net – 脚本标签和链接标签进入asp:内容或外部
- 选择顶部N值,但跳过M个结果
- Asp.net webForm设置允许表单提交Html的方法
- asp.net-mvc – 在MVC Controller中访问GET参数
- asp.net – 选择框更改事件中的setTimeout
- asp.net文件上传示例分享
- asp.net-mvc – ASP.NET MVC jQueryUI datepicker在使用AJA
- asp.net-mvc-3 – Telerik MVC网格,在运行时从集合或字典中
推荐文章
站长推荐
- asp.net-mvc – 为什么MVC4捆绑捆绑Knockout.js?
- 如何在ASP.NET和C#中加载下拉列表?
- asp.net – 在MVC3或IIS 7.5中禁用x-frame-optio
- ASP.NET MVC API 接口验证的示例代码
- asp.net-mvc-3 – 局部视图中的RenderSection
- asp.net-mvc – 保存后显示相同的页面
- 在IIS / ASP.Net中的.NET 1.1应用程序中创建.NET
- asp.net – 使用/ signalr / ping调用时使用长轮
- asp.net-mvc – 当我不知道内容类型时如何返回文
- asp.net-mvc – 使用Asp.net MVC 4中的OutputCac
热点阅读
