asp.net-mvc-3 – 如何在本地测试时禁用elmah发送电子邮件?
发布时间:2020-09-01 10:01:14 所属栏目: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编程实现删除文件夹及文件夹下文件的方法
- asp-classic – 如何使用AES在VBScript中进行加密?
- 集成ASP.NET Webforms,WebAPI和AngularJS
- Asp.net core WebApi 使用Swagger生成帮助页实例
- asp.net – 为什么HttpContext.Current.User.Identity.Name
- asp.net-web-api – 首先使用ASP.NET Web API的EF5代码:更
- asp.net – 转发器控件中的单选按钮列表
- asp.net-mvc – 根据浏览器接受语言自动设置uiCulture
- asp.net-mvc – ASP.net身份在删除外部帐户后停止分发外部C
- 如何在ASP.NET 5中添加一个TypeScript绝对类型的定义?
推荐文章
站长推荐
- asp.net – 我如何使用AJAX来确定用户的会话是否
- asp.net-mvc – Azure git部署 – 第二个程序集中
- asp.net – __doPostBack在DotNetNuke网站上未定
- Asp.Net的FileUpload类实现上传文件实例
- 利用ASP.NET MVC和Bootstrap快速搭建个人博客之后
- asp.net – UserControl Viewstate在回发后丢失所
- asp.net-mvc-4 – .net 4.5 ASP.Net web API JSO
- 如何以编程方式将ListItems添加到ASP.NET中的Dro
- asp.net – 注册.NET 4.5 IIS 10 Windows 10
- asp.net-mvc – 可以浏览DataAnnotations的自定义
热点阅读
