如何使用 .NET Core 配置 Elmah 以登录 SQL?
How do I configure Elmah with .NET Core to log to SQL?
我已经安装了包 "ElmahCore",它允许我在 .NET Core 中使用 Elmah。设置者:
services.AddElmah();
在startup.cs
我想将其更改为登录到 SQL,以便它持久存在。但是不清楚如何 - 没有 web.config,它似乎没有配置。我看不到任何选项来添加 SQL 日志记录。
有一个 elmah.corelibrary nuget package
,但它似乎无法与第一个库一起使用 - 执行 services.AddElmah<SqlErrorLog>
已被建议的 elsewehre 不起作用,因为它是错误的 ErrorLog
class.
或者,如果有更好的 .net 核心框架可以持久记录异常并允许发送通知电子邮件,我将不胜感激,我想知道 Elmah 是否已过期。
elmah.corelibrary
包是 ASP.NET 的 ELMAH 的一部分(非核心)。要从 ASP.NET 核心登录到 SQL 服务器,您需要安装 ElmahCore.Sql
NuGet 包以获取正确的 SqlErrorLog
class:
using ElmahCore.Mvc;
using ElmahCore.Sql;
...
services.AddElmah<SqlErrorLog>(options =>
{
options.ConnectionString = "Server=localhost;Database=ELMAH;Integrated Security=True;";
});
至于你对ELMAH的提问,总的来说,肯定是没死。 ASP.NET 的 ELMAH 已经完成,而在不同日志 "appenders" 上的工作仍在进行。 ElmahCore 是原始 ELMAH 代码的端口,支持 ASP.NET 核心。我是 elmah.io which offer you to store error messages in the cloud (as well as a range of other features which makes the name confusing I know). There are similar solutions out there like Raygun and Stackify.
的创始人
我已经安装了包 "ElmahCore",它允许我在 .NET Core 中使用 Elmah。设置者:
services.AddElmah();
在startup.cs
我想将其更改为登录到 SQL,以便它持久存在。但是不清楚如何 - 没有 web.config,它似乎没有配置。我看不到任何选项来添加 SQL 日志记录。
有一个 elmah.corelibrary nuget package
,但它似乎无法与第一个库一起使用 - 执行 services.AddElmah<SqlErrorLog>
已被建议的 elsewehre 不起作用,因为它是错误的 ErrorLog
class.
或者,如果有更好的 .net 核心框架可以持久记录异常并允许发送通知电子邮件,我将不胜感激,我想知道 Elmah 是否已过期。
elmah.corelibrary
包是 ASP.NET 的 ELMAH 的一部分(非核心)。要从 ASP.NET 核心登录到 SQL 服务器,您需要安装 ElmahCore.Sql
NuGet 包以获取正确的 SqlErrorLog
class:
using ElmahCore.Mvc;
using ElmahCore.Sql;
...
services.AddElmah<SqlErrorLog>(options =>
{
options.ConnectionString = "Server=localhost;Database=ELMAH;Integrated Security=True;";
});
至于你对ELMAH的提问,总的来说,肯定是没死。 ASP.NET 的 ELMAH 已经完成,而在不同日志 "appenders" 上的工作仍在进行。 ElmahCore 是原始 ELMAH 代码的端口,支持 ASP.NET 核心。我是 elmah.io which offer you to store error messages in the cloud (as well as a range of other features which makes the name confusing I know). There are similar solutions out there like Raygun and Stackify.
的创始人