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. SubSonic フォルダからそこにある DLL への参照として MySQL.Data を直接追加します。
  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

初期化文字列の形式の詳細については、このブログを確認してください

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 に答える
1

どこかで''を期待していると思います。それは{0}、忘れたときに発生するエラーです(IIRC)。

于 2009-04-30T11:35:13.350 に答える