2

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

在尝试获取 MySQL 的连接字符串 3 小时后,我即将放弃它。

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

4

3 回答 3

7

我是个白痴:

 <SubSonicService defaultProvider="ConfigDatabase">

应该:

 <SubSonicService defaultProvider="MySqlDataProvider">

嗬!

于 2009-04-30T12:25:18.643 回答
1

我猜它在{0}某处需要一个'',因为这是你忘记时得到的错误(IIRC)。

于 2009-04-30T11:35:13.350 回答
1

查看此博客以获取有关初始化字符串格式的更多信息

http://menononnet.wordpress.com/2008/02/23/format-of-the-initialization-string-does-not-conform-to-specification-starting-at-index-0/

于 2011-06-29T06:39:16.050 回答