C# NLog数据库日志记录提供system.argumentexception无法找到请求的.net framework数据提供程序,可能未安装该提供程序

C# NLog数据库日志记录提供system.argumentexception无法找到请求的.net framework数据提供程序,可能未安装该提供程序,c#,.net,entity-framework,nlog,C#,.net,Entity Framework,Nlog,我已将NLog添加到我的Windows服务应用程序的数据库日志中。当我使用private readonly logger\u logger=LogManager.GetCurrentClassLogger()初始化记录器时I getsystem.argumentexception无法找到请求的.net framework数据提供程序它可能未安装 App.config中的MyconnectionString: <connectionStrings> <add name

我已将NLog添加到我的Windows服务应用程序的数据库日志中。当我使用
private readonly logger\u logger=LogManager.GetCurrentClassLogger()初始化记录器时
I get
system.argumentexception无法找到请求的.net framework数据提供程序它可能未安装

App.config中的My
connectionString

  <connectionStrings>
    <add name="DbEntities" connectionString="metadata=res://*/;provider=System.Data.SqlClient;provider connection string=&quot;data source=x.database.windows.net;initial catalog=db;persist security info=True;user id=x;password=x;multipleactiveresultsets=True;application name=EntityFramework&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>

在NLog.config中:

<targets>

    <target name="database" xsi:type="Database">

      <connectionStringName>DbEntities</connectionStringName>
      <commandText>
        insert into dbo.Log (Application, Logged, Level, Message, Logger, CallSite, Exception) values (@Application, @Logged, @Level, @Message,@Logger, @Callsite, @Exception);
      </commandText>

      <parameter name="@application" layout="app" />
      <parameter name="@logged" layout="${date}" />
      <parameter name="@level" layout="${level}" />
      <parameter name="@message" layout="${message}" />

      <parameter name="@logger" layout="${logger}" />
      <parameter name="@callSite" layout="${callsite}" />
      <parameter name="@exception" layout="${exception:tostring}" />
    </target>

  </targets>

数据库实体
在dbo.Log(Application、Logged、Level、Message、Logger、CallSite、Exception)中插入值(@Application、@Logged、@Level、@Message、@Logger、@CallSite、@Exception);
在references下,我有
EntityFramework
EntityFramework.SqlServer

如何解决此问题?我尝试重新安装EntityFramework。我尝试以32位模式运行我的应用程序

对于我的所有其他应用程序,我从未遇到过像这样添加NLog的问题


谢谢。

您使用的是什么版本的NLog?你检查过InternalLogger吗?@RolfKristensen我有最新版本4.5.3。内部日志显示2018-04-27 09:36:52.9149初始化目标“数据库目标[数据库]”时出错。异常:System.ArgumentException:找不到请求的.Net Framework数据提供程序。它可能没有安装。在NLog.Targets.DatabaseTarget.InitializeTarget()的System.Data.Common.DbProviderFactorys.GetFactory(String providerInvariantName)中,在NLog.Targets.Target.InitializeTarget()中,在NLog.Targets.Initialize(LoggingConfiguration配置)中,如果将
DbProviderFactorys.GetFactoryClasses().Rows
添加到调试监视并展开以显示,调试器会显示什么“结果视图”。是否有项的ItemArray属性包含值
System.Data.SqlClient