log4net和MySQL有问题

log4net和MySQL有问题,mysql,.net,vb.net,visual-studio-2012,log4net,Mysql,.net,Vb.net,Visual Studio 2012,Log4net,我使用的平台是Visual Basic 2012和Visual Studio professional 2012 我在我的项目中安装了log4net,版本是1.2.13,通过nuGet数据包管理器安装 通过测试log4net,它似乎工作正常 但是自从我安装了log4net之后,所有与MySQL相关的操作都不再有效了。 我还通过NuGet数据包管理器安装了MySQL连接器,它是版本6.7.4 我肯定是从log4net中找到了与安装相关的问题,因为当我从app.config中完全删除log4net相

我使用的平台是Visual Basic 2012和Visual Studio professional 2012

我在我的项目中安装了log4net,版本是1.2.13,通过nuGet数据包管理器安装

通过测试log4net,它似乎工作正常

但是自从我安装了log4net之后,所有与MySQL相关的操作都不再有效了。 我还通过NuGet数据包管理器安装了MySQL连接器,它是版本6.7.4

我肯定是从log4net中找到了与安装相关的问题,因为当我从app.config中完全删除log4net相关的xml时,所有MySQL操作都会正常工作

app.config中的log4net代码:

<configSections>
 <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
</configSections>
<log4net>
 <root>
  <level value="ALL"/>
  <appender-ref ref="RollingLogFileAppender"/>
 </root>
 <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
 <file value="logfile.txt"/>
 <appendToFile value="true" />
 <rollingStyle value="Size" />
 <maxSizeRollBackups value="5" />
 <maximumFileSize value="10MB" />
 <staticLogFileName value="true" />
 <layout type="log4net.Layout.PatternLayout">
  <conversionPattern value="%date %-5level %logger.%M[%thread]: %message%newline"/>
 </layout>
 </appender>
</log4net>
AssemblyInfo.vb中的log4net代码:

<Assembly: log4net.Config.XmlConfigurator(Watch:=True)> 

数据库查询示例:

Private Sub btnMySQLScalarQuery_Click(sender As Object, e As EventArgs) Handles     btnMySQLScalarQuery.Click

    Dim DatabaseAccessObject As New classDatabaseAccess With {.MySQLIpAdress = "10.140.140.220", .MySQLUsername = "admin", .MySQLPassword = "adminxyz", .MySQLDBName = "sensors", .ErrorMsg = True}

    Try
        Using command As New MySqlCommand
            Using connection As New MySqlConnection((DatabaseAccessObject.GetMySQLConnectionString()))
                **connection.Open()**
                command.Connection = connection
                command.CommandText = "SELECT COUNT(*) FROM wims_detections WHERE id > @start AND id < @end"
                command.Prepare()
                command.Parameters.AddWithValue("@start", 100)
                command.Parameters.AddWithValue("@end", 1000)
                connection.Close()
            End Using

            MessageBox.Show(DatabaseAccessObject.ScalarQuery(command))
        End Using
    Catch ex As Exception

    End Try
End Sub
私有子btnMySQLScalarQuery\u单击(发送方作为对象,e作为事件参数)处理btnMySQLScalarQuery。单击
使用{.mysqlipAddress=“10.140.140.220”、.MySQLUsername=“admin”、.MySQLPassword=“adminxyz”、.MySQLDBName=“sensors”、.ErrorMsg=True}将DatabaseAccessObject作为新的classDatabaseAccess进行Dim
尝试
将命令用作新的MySqlCommand
将连接用作新的MySqlConnection((DatabaseAccessObject.GetMySQLConnectionString())
**connection.Open()**
command.Connection=Connection
command.CommandText=“从wims_检测中选择计数(*),其中id>@start和id<@end”
command.Prepare()
command.Parameters.AddWithValue(“@start”,100)
command.Parameters.AddWithValue(“@end”,1000)
连接。关闭()
终端使用
Show(DatabaseAccessObject.ScalarQuery(命令))
终端使用
特例
结束尝试
端接头
这是由于app.config中有代码而激活log4net时收到的错误消息:

<configSections>
 <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
</configSections>
<log4net>
 <root>
  <level value="ALL"/>
  <appender-ref ref="RollingLogFileAppender"/>
 </root>
 <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
 <file value="logfile.txt"/>
 <appendToFile value="true" />
 <rollingStyle value="Size" />
 <maxSizeRollBackups value="5" />
 <maximumFileSize value="10MB" />
 <staticLogFileName value="true" />
 <layout type="log4net.Layout.PatternLayout">
  <conversionPattern value="%date %-5level %logger.%M[%thread]: %message%newline"/>
 </layout>
 </appender>
</log4net>
MySql.Data.MySqlClient.Replication.ReplicationManager”的类型初始值设定项生成了一个异常。

我没有使用ReplicationManager。。。!但复制管理器与log4net之间存在某种问题

错误发生在我试图打开数据库连接的行中。。。connection.open()

这里我必须注意,我在我的项目中也使用了SQLite,强硬的SQLite绝对不受这个问题的影响-即使强硬,我也以与SQLite相同的方式构建了MySQL查询/非查询/事务

需要帮助


亲切问候…

你的app.config中也有MySQL配置吗?只是提醒一下,你没有从你的问题中清除联合国和PW。完全的例外是什么?有相同的问题-任何解决方案?