.net - MySQL & .NET : System. ArgumentException:初始化字符串的格式不符合从索引 0 开始的规范

标签 .net asp.net subsonic

我想使用 SubSonic,因为它说它易于使用且节省时间。

经过 3 小时尝试正确获取 MySQL 的连接字符串后,我将要放弃它。

Building configuration from C:\Documents and Settings\user\My Documents\Visual Studio 2

008\Projects\ConfigurationItems\ConfigurationItemsMVC\Web.config
Adding connection to MySqlDataProvider
ERROR: Trying to execute generate
Error Message: System.ArgumentException: Format of the initialization string does not conform to specification starting at index 0.

我无法改变这个:错误消息:System.ArgumentException:初始化字符串的格式不符合从索引 0 开始的规范。

我每次尝试运行 subsonic.exe/generate 时都会得到它

一切看起来都很简单!!!

这是我的 Web.Config

<!-- connectionString="Persist Security Info=False;database=config;server=localhost;user id=config;Password=config" -->
  <connectionStrings>
    <remove name="ConfigConnectString"/>
    <add name="ConfigConnectString" connectionString="Persist Security Info=False;database=config;server=localhost;user id=userid;Password=password" providerName="MySql.Data.MySqlClient"
      />
    </connectionStrings>

  <SubSonicService defaultProvider="ConfigDatabase">
      <providers>
        <add type="SubSonic.MySqlDataProvider, SubSonic" 
             name="MySqlDataProvider" 
             generatedNamespace="Config" 
             connectionStringName="ConfigConnectString" 
             />

      </providers>
  </SubSonicService>

我已经尝试了一些事情:

  1. 使用外部工具路径上的/config 指定 webconfig 的路径。
  2. 根据示例从 6.0 .NET MySQL 连接器降级到最新的 5.2 版本。
  3. 将 MySQL.Data 作为引用直接从 SubSonic 文件夹添加到其中的 DLL。
  4. 根据 http://www.connectionstrings.com/mysql#28 尝试各种格式的连接字符串

(其他连接字符串:“Server=localhost;Database=config;Uid=user;Pwd=password;”- 还有“blah”/“anything”会抛出同样的错误...)

不快乐!非常接近放弃 SubSonic。如果可以,请帮忙!

顺便说一句,我正在使用 Subsonic 2.2

最佳答案

我是个白痴:

 <SubSonicService defaultProvider="ConfigDatabase">

应该是:

 <SubSonicService defaultProvider="MySqlDataProvider">

呸!

关于.net - MySQL & .NET : System. ArgumentException:初始化字符串的格式不符合从索引 0 开始的规范,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/806435/

相关文章:

c# - “Session”引发了 system.web.httpexception 类型的异常

subsonic - 使用哪个 SubSonic 3 模板

subsonic - 如果您对 SubSonic 有一个愿望,那会是什么?

.net - .NET 中计费/发票软件设计的最佳实践

c# - 正确实现的递归惰性迭代器函数将不会堆栈溢出吗?

c# - public static vs static public - 有区别吗?

asp.net - AJAX.BeginForm 发送空 FormCollection 列表到 MVC Controller

asp.net - 通过代码更改 ASP.NET 成员资格提供程序

c# - 采用哪种 DAL 方法?

c# - 我想在将鼠标悬停在 ASP.NET 标签上时显示一条消息