.net 有时NLog.Extensions.AzureTableStorage返回错误的请求

.net 有时NLog.Extensions.AzureTableStorage返回错误的请求,.net,entity-framework,azure,azure-sql-database,azure-table-storage,.net,Entity Framework,Azure,Azure Sql Database,Azure Table Storage,我正在使用azure表和NLog(NLog.Extensions.AzureTableStorage)来编写SQL审计日志, 这是通过在Entity framework中创建一个数据库拦截器来完成的,它在大多数情况下都能正常工作,但有时我会收到一个错误的请求,这可以从应用程序洞察中观察到 下面是用于编写日志的代码 public class DBCommandInterceptor : DbCommandInterceptor { private readonly Log

我正在使用azure表和NLog(NLog.Extensions.AzureTableStorage)来编写SQL审计日志, 这是通过在Entity framework中创建一个数据库拦截器来完成的,它在大多数情况下都能正常工作,但有时我会收到一个错误的请求,这可以从应用程序洞察中观察到

下面是用于编写日志的代码

public class DBCommandInterceptor : DbCommandInterceptor
    {

        private readonly Logger _logger = LogManager.GetLogger("SQLAuditLog");

        public override void NonQueryExecuting(DbCommand command, DbCommandInterceptionContext<int> interceptionContext)
        {
            HandleCommandExecuting(command);
        }

        public override void ReaderExecuting(DbCommand command, DbCommandInterceptionContext<DbDataReader> interceptionContext)
        {
            HandleCommandExecuting(command);
        }

        public override void ScalarExecuting(DbCommand command, DbCommandInterceptionContext<object> interceptionContext)
        {
            HandleCommandExecuting(command);
        }

        private void HandleCommandExecuting(DbCommand command)
        {           
            LogEventInfo eventLog = new LogEventInfo(LogLevel.Trace,_logger.Name, command.CommandText);
            eventLog.Properties["Query"] = command.CommandText;
            eventLog.Message = $"{ command.CommandText} ";
            _logger.Log(eventLog);

        }
    }
公共类DBCommandInterceptor:DBCommandInterceptor
{
私有只读记录器_Logger=LogManager.GetLogger(“SQLAuditLog”);
public override void NonQueryExecuting(DbCommand命令,DbCommandInterceptionContext interceptionContext)
{
HandleCommandExecuting(命令);
}
公共重写void ReaderExecuting(DbCommand命令,DbCommandInterceptionContext interceptionContext)
{
HandleCommandExecuting(命令);
}
公共覆盖无效缩放执行(DbCommand命令,DbCommandInterceptionContext interceptionContext)
{
HandleCommandExecuting(命令);
}
私有void HandleCommandExecuting(DbCommand命令)
{           
LogEventInfo eventLog=新的LogEventInfo(LogLevel.Trace、_logger.Name、command.CommandText);
eventLog.Properties[“Query”]=command.CommandText;
eventLog.Message=$“{command.CommandText}”;
_logger.Log(eventLog);
}
}

错误请求错误的原因是什么?

错误请求(400状态代码)通常意味着无效数据。当你得到这个错误时,你能分享正在被存储的数据吗?数据不能从应用程序中得到。有没有办法看到我失败的有效负载?考虑试用(也支持Azure表存储)。它使用来自Microsoft的最新Azure存储库。参见文档:错误请求(400状态代码)错误通常意味着无效数据。当你得到这个错误时,你能分享正在被存储的数据吗?数据不能从应用程序中得到。有没有办法看到我失败的有效负载?考虑试用(也支持Azure表存储)。它使用来自Microsoft的最新Azure存储库。见文件: