【发布时间】:2012-12-04 13:04:06
【问题描述】:
我阅读了这里已经发布的所有答案,但似乎没有一个可以解决。 即使我收到这些警告,Elmah 的工作也完美无缺。当我在 Visual Studio 2012 中启动调试 (f5) 时,我也遇到了这些错误。在构建时一切都很好。
web.config 中的配置部分很简单,所以我真的不知道如何解决它:
<configuration>
<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>
<elmah>
<security allowRemoteAccess="1" />
<errorLog type="Elmah.SqlErrorLog, Elmah" connectionStringName="EvaConnection" />
<!--<errorLog type="Elmah.XmlFileErrorLog, Elmah" logPath="~/App_Data/ErrorLogs" />-->
<!-- ELMAH class ErrorMailModule.cs has been modified to read config from AppSettings -->
<errorMail from="dummy@dummy.com" to="dummy@dummy.com" subject="dummy" priority="High" async="true" smtpPort="25" smtpServer="dummy" useSsl="false" userName="dummy@dummy.com" password="dummy" noYsod="false" />
</elmah>
【问题讨论】:
-
为了将来参考,GitHub 上有一个可用的 ELMAH 模式:github.com/elmahio/Elmah-Schema。您可以在此处阅读有关它的更多信息并查看有关如何使用它的示例:blog.elmah.io/the-elmah-schema
-
要让 Intellisense 识别架构,至少在 Visual Studio 2015 中,架构根元素必须添加引用目标命名空间的默认命名空间属性:
<xs:schema xmlns:tns="http://Elmah.Configuration" elementFormDefault="qualified" attributeFormDefault="unqualified" targetNamespace="http://Elmah.Configuration" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://Elmah.Configuration">。
标签: asp.net web-config elmah configsection