.Net Core Cap 异常

近期观察日志发现每次服务重启都会出现如下Cap 错误日志。环境.Net Core 3.1DotNetCore.CAP, Version=3.0.3.0DotNetCore.CAP.MySql, Version=3.0.3.0[05:54:21 INF] Starting the processing server.at DotNetCo...

近期观察日志发现每次服务重启都会出现如下Cap 错误日志。

环境

.Net Core 3.1

DotNetCore.CAP, Version=3.0.3.0

DotNetCore.CAP.MySql, Version=3.0.3.0

[05:54:21 INF] Starting the processing server.
   at DotNetCore.CAP.Internal.Bootstrapper.BootstrapAsync(CancellationToken stoppingToken)
   at DotNetCore.CAP.MySql.MySqlStorageInitializer.InitializeAsync(CancellationToken cancellationToken)
   at DotNetCore.CAP.MySql.MySqlStorageInitializer.InitializeAsync(CancellationToken cancellationToken)
   at Dapper.SqlMapper.ExecuteImplAsync(IDbConnection cnn, CommandDefinition command, Object param) in C:\projects\dapper\Dapper\SqlMapper.Async.cs:line 678
   at MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQueryAsync(IOBehavior ioBehavior, CancellationToken cancellationToken) in C:\projects\mysqlconnector\src\MySqlConnector\MySql.Data.MySqlClient\MySqlCommand.cs:line 226
   at MySqlConnector.Core.CommandExecutor.ExecuteReaderAsync(IReadOnlyList`1 commands, ICommandPayloadCreator payloadCreator, CommandBehavior behavior, IOBehavior ioBehavior, CancellationToken cancellationToken)
in C:\projects\mysqlconnector\src\MySqlConnector\Core\CommandExecutor.cs:line 62 at MySql.Data.MySqlClient.MySqlDataReader.CreateAsync(CommandListPosition commandListPosition, ICommandPayloadCreator payloadCreator, IDictionary`2 cachedProcedures, IMySqlCommand command,
CommandBehavior behavior, IOBehavior ioBehavior, CancellationToken cancellationToken) in
C:\projects\mysqlconnector\src\MySqlConnector\MySql.Data.MySqlClient\MySqlDataReader.cs:line 391 at MySql.Data.MySqlClient.MySqlDataReader.ActivateResultSet() in C:\projects\mysqlconnector\src\MySqlConnector\MySql.Data.MySqlClient\MySqlDataReader.cs:line 130 at MySqlConnector.Core.ResultSet.ReadResultSetHeaderAsync(IOBehavior ioBehavior) in C:\projects\mysqlconnector\src\MySqlConnector\Core\ResultSet.cs:line 49 ---> MySql.Data.MySqlClient.MySqlException (0x80004005): CREATE command denied to user 'connection string' for table 'XXX_TableName'

  通过下载源码分析(https://github.com/dotnetcore/CAP), 发现AddCap内部添加了 HostedService

 

HostedService 内部调用了Create Table 的Sql执行

 

 

 

处理方法:

将此函数重写下,就处理了

 

本文标题为:.Net Core Cap 异常

基础教程推荐