Elmah.io ,访问 http://localhost:port/elmah 时看不到日志
Elmah.io , can't see logs when accessing http://localhost:port/elmah
我是 elmah.io 的新手,我正在尝试将其与 ASP.NET Mvc 应用程序集成。
问题是,当我访问 http://localhost:port/elmah 时,即使在 elmah.io.
中记录了错误,我也看不到日志
https://i.stack.imgur.com/ifgXS.png
<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>
....
<add key="elmah.mvc.disableHandler" value="false" />
<add key="elmah.mvc.disableHandleErrorFilter" value="false" />
<add key="elmah.mvc.requiresAuthentication" value="false" />
<add key="elmah.mvc.IgnoreDefaultRoute" value="false" />
<add key="elmah.mvc.allowedRoles" value="*" />
<add key="elmah.mvc.allowedUsers" value="*" />
<add key="elmah.mvc.route" value="elmah" />
<add key="elmah.mvc.UserAuthCaseSensitive" value="true" />
....
<system.web>
<httpModules>
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
<add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
<add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" />
</httpModules>
....
<system.webServer>
<modules>
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" preCondition="managedHandler" />
<add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" preCondition="managedHandler" />
<add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" preCondition="managedHandler" />
...
<elmah>
<security allowRemoteAccess="true" />
<errorLog type="Elmah.Io.ErrorLog, Elmah.Io" apiKey="xxxxxx" logId="xxxxxxx"
applicationName="xxxx"/>
</elmah>
那是因为 elmah.io offer its own UI with extended features not available on the ELMAH UI. You can enable the ELMAH UI by turning on the Messages | Read permission as shown here: How to configure API key permissions。我不建议这样做,因为有人拿到了您的 API 密钥,然后可以访问您的错误日志。因此,请登录 elmah.io 并在那里浏览您的错误日志以获得更好、更安全的解决方案。
此外,您应该通过将 allowRemoteAccess
设置为 false
来禁止远程访问。使用您当前的配置,您允许每个人查看您的错误日志(至少如果您如上所述启用读取访问权限)。
我是 elmah.io 的新手,我正在尝试将其与 ASP.NET Mvc 应用程序集成。 问题是,当我访问 http://localhost:port/elmah 时,即使在 elmah.io.
中记录了错误,我也看不到日志https://i.stack.imgur.com/ifgXS.png
<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>
....
<add key="elmah.mvc.disableHandler" value="false" />
<add key="elmah.mvc.disableHandleErrorFilter" value="false" />
<add key="elmah.mvc.requiresAuthentication" value="false" />
<add key="elmah.mvc.IgnoreDefaultRoute" value="false" />
<add key="elmah.mvc.allowedRoles" value="*" />
<add key="elmah.mvc.allowedUsers" value="*" />
<add key="elmah.mvc.route" value="elmah" />
<add key="elmah.mvc.UserAuthCaseSensitive" value="true" />
....
<system.web>
<httpModules>
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
<add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
<add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" />
</httpModules>
....
<system.webServer>
<modules>
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" preCondition="managedHandler" />
<add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" preCondition="managedHandler" />
<add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" preCondition="managedHandler" />
...
<elmah>
<security allowRemoteAccess="true" />
<errorLog type="Elmah.Io.ErrorLog, Elmah.Io" apiKey="xxxxxx" logId="xxxxxxx"
applicationName="xxxx"/>
</elmah>
那是因为 elmah.io offer its own UI with extended features not available on the ELMAH UI. You can enable the ELMAH UI by turning on the Messages | Read permission as shown here: How to configure API key permissions。我不建议这样做,因为有人拿到了您的 API 密钥,然后可以访问您的错误日志。因此,请登录 elmah.io 并在那里浏览您的错误日志以获得更好、更安全的解决方案。
此外,您应该通过将 allowRemoteAccess
设置为 false
来禁止远程访问。使用您当前的配置,您允许每个人查看您的错误日志(至少如果您如上所述启用读取访问权限)。