问题
i have installed vs2010 beta2, create a MVC website, i want to use subsoinc access a mysql database in SimpleRepository, when run the website, i get error: "Unable to find the requested .Net Framework Data Provider. It may not be installed. ".
var repo = new SimpleRepository("NorthwindMySql", SimpleRepositoryOptions.None);
var user = repo.Find<Models.User>(u => u.Username == "mm");
ViewData["UserData"] = user;
then, i use my vs2008 do the same thing, this time, the website works just fine. how can i fix this? thanks.
回答1:
It is possible that you need to add this to your web.config file:
<system.data> <DbProviderFactories> <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.2.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" /> </DbProviderFactories> </system.data>
as the MySQL driver didn't register with the .NET 4 machine.config (.NET 4 was installed only after the MySQL connectivity drivers were installed).
Notice that the version of the MySQL driver you have may vary.
来源:https://stackoverflow.com/questions/2062189/subsonic-3-0-0-3-with-mysql-can-not-work-in-net-4-0