【问题标题】:.Net application with MySql connector on linux.Net 应用程序与 Linux 上的 MySql 连接器
【发布时间】:2013-08-26 06:00:42
【问题描述】:

我正在制作一个使用 MySql.Data.dll 连接到数据库的应用程序。它在 Windows 上运行良好,但拒绝在 Linux 上运行(在 Centos 和 Fedora 上试过)。我尝试在 Visual C# Express 和 MonoDevelop 上编译,在 dll 上下载另一个版本,使项目 .Net 2.0 ... 没有任何效果。

我收到以下错误:

未处理的异常: System.ArgumentException:初始化字符串的格式不符合索引 73 处的规范。 在 System.Data.Common.DbConnectionStringBuilder.ParseConnectionStringNonOdbc (System.String connectionString) [0x00401] 在 /usr/src/mono/mcs/class/System.Data/System.Data.Common/DbConnectionStringBuilder.cs:771 在 System.Data.Common.DbConnectionStringBuilder.ParseConnectionString (System.String connectionString) [0x00017] 在 /usr/src/mono/mcs/class/System.Data/System.Data.Common/DbConnectionStringBuilder.cs:531 在 /usr/src/mono/mcs/class/System.Data/System.Data.Common/DbConnectionStringBuilder.cs:97 中的 System.Data.Common.DbConnectionStringBuilder.set_ConnectionString(System.String 值)[0x0001e] 在 MySql.Data.MySqlClient.MySqlConnectionStringBuilder..ctor (System.String connStr) [0x00000] 中:0 在 MySql.Data.MySqlClient.MySqlConnection.set_ConnectionString(System.String 值)[0x00000] 中:0 在 MySql.Data.MySqlClient.MySqlConnection..ctor (System.String connectionString) [0x00000] in :0 在 (wrapper remoting-invoke-with-check) MySql.Data.MySqlClient.MySqlConnection:.ctor (string) 在 Plate.MySQLConnection.Select (System.Windows.Forms.DataGridView& _dataGrid, System.String[] select, System.String from, Plate.FieldValue[] where, System.String[] order_by) [0x0000f] in /home/ukus /Desktop/MonoDev/Place/MySQLConnection.cs:241 在 /home/ukus/Desktop/MonoDev/Place/GlavniForm.cs:43 中的 Plate.GlavniForm.ReloadMeseci () [0x0006f] 在 /home/ukus/Desktop/MonoDev/Place/GlavniForm.cs:28 中的 Plate.GlavniForm..ctor () [0x00020] 在 (wrapper remoting-invoke-with-check) Plate.GlavniForm:.ctor () 在 /home/ukus/Desktop/MonoDev/Place/Program.cs:18 中的 Plate.Program.Main () [0x0000c] [错误] 致命的未处理异常:System.ArgumentException:初始化字符串的格式不符合索引 73 处的规范。 在 System.Data.Common.DbConnectionStringBuilder.ParseConnectionStringNonOdbc (System.String connectionString) [0x00401] 在 /usr/src/mono/mcs/class/System.Data/System.Data.Common/DbConnectionStringBuilder.cs:771 在 System.Data.Common.DbConnectionStringBuilder.ParseConnectionString (System.String connectionString) [0x00017] 在 /usr/src/mono/mcs/class/System.Data/System.Data.Common/DbConnectionStringBuilder.cs:531 在 /usr/src/mono/mcs/class/System.Data/System.Data.Common/DbConnectionStringBuilder.cs:97 中的 System.Data.Common.DbConnectionStringBuilder.set_ConnectionString(System.String 值)[0x0001e] 在 MySql.Data.MySqlClient.MySqlConnectionStringBuilder..ctor (System.String connStr) [0x00000] 中:0 在 MySql.Data.MySqlClient.MySqlConnection.set_ConnectionString(System.String 值)[0x00000] 中:0 在 MySql.Data.MySqlClient.MySqlConnection..ctor (System.String connectionString) [0x00000] in :0 在 (wrapper remoting-invoke-with-check) MySql.Data.MySqlClient.MySqlConnection:.ctor (string) 在 Plate.MySQLConnection.Select (System.Windows.Forms.DataGridView& _dataGrid, System.String[] select, System.String from, Plate.FieldValue[] where, System.String[] order_by) [0x0000f] in /home/ukus /Desktop/MonoDev/Place/MySQLConnection.cs:241 在 /home/ukus/Desktop/MonoDev/Place/GlavniForm.cs:43 中的 Plate.GlavniForm.ReloadMeseci () [0x0006f] 在 /home/ukus/Desktop/MonoDev/Place/GlavniForm.cs:28 中的 Plate.GlavniForm..ctor () [0x00020] 在 (wrapper remoting-invoke-with-check) Plate.GlavniForm:.ctor () 在 /home/ukus/Desktop/MonoDev/Place/Program.cs:18 中的 Plate.Program.Main () [0x0000c]

应用程序在 Visual C# Express 和 MonoDevelop 上都成功构建。

【问题讨论】:

  • 应用程序在 Visual C# Express 和 MonoDevelop 上都成功构建。
  • 显示出现此错误的代码
  • 没有“给出此错误的代码”。
  • 编译运行没有错误。

标签: c# mysql linux connector


【解决方案1】:

我发现了问题。由于连接字符串,该应用程序无法在 Linux 上运行。问题可能在于 Mono 不等同于 .Net。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-06-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-05
    相关资源
    最近更新 更多