我想使用 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>
我尝试了几件事:
- 在外部工具路径上使用 /config 指定 webconfig 的路径。
- 根据示例从 6.0 .NET MySQL 连接器降级到最新的 5.2 版本。
- 将 MySQL.Data 作为引用直接从 SubSonic 文件夹添加到其中的 DLL。
- 尝试各种格式的连接字符串,基于http://www.connectionstrings.com/mysql#28
(其他连接字符串:“Server=localhost;Database=config;Uid=user;Pwd=password;”- “blah”/“anything”也会抛出同样的错误......)
没有欢乐!非常接近放弃 SubSonic。如果可以的话请帮忙!
顺便说一句,我正在使用 Subsonic 2.2