【发布时间】:2015-05-30 13:13:48
【问题描述】:
我正在尝试让 elmah 在 C# 控制台应用程序中工作。
我知道它不是为在控制台应用程序中工作而设计的,但我注意到其他人正在使用一些变通方法来做到这一点。我查看了相关帖子并找到了设置 App.Config Here 的示例,但是当我尝试插入 configSections 和 elmah 片段时,我得到了配置异常。
我在 Web 应用程序中多次使用 elmah,我想我只需要整理一下 App.Config 文件。我可能放错地方了。
这是我的 App.Config 文件(连接字符串故意散列)
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" />
</startup>
<connectionStrings>
<add name="elmah-mysql" connectionString="###############" providerName="MySQL.Data" />
</connectionStrings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.7.4.0" newVersion="6.7.4.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<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>
<errorLog type="Elmah.MySqlErrorLog, Elmah" connectionStringName="elmah-mysql" />
</elmah>
</configuration>
有人发现我哪里出错了吗?
【问题讨论】:
标签: c# .net console-application elmah