问题
I'm using VS2010 with the MySQL .NET Connector. My project that used to work started reporting:
Error 175: The specified data store provider cannot be found, or is not valid.
I don't know why, though things got weird after a MS recommended hotfix to VS.
Sure enough, if I go to add a test ADO.NET Entity Data Model to the project, the Entity Data Model Wizard that generates the .edmx file does not show the data provider when I select 'Generate from database'. Worse yet, right-clicking and attempting to do an 'Update Model from Database...' on an existing .edmx file sends VS2010 into a death spiral of dialog boxes that can only be terminated with Task Manager.
Here's how I fix it: Shutdown VS2010. Uninstall the MySQL Connector completely. Reboot. Install the MySQL Connector completely. Reboot. Restart VS2010.
Suddenly, my data provider exists. I can compile my code. As well as add test .edmx files. The wizard sees my MySQL database, passes the test connection, and builds object models with my relational tables. I can clean/rebuild as much as I want.
All's good until I run the app. My "fix" doesn't stick.
At that point an exception is thrown stating that the connection object is returning null, and if I recompile with no code changes, I get the Error 175 error again. Lather, rinse, repeat.
Some experiments based off of this StackOverflow answer, show that the Connection String is valid, and using the MySqlConnection object, I can access the database and roll my own working queries in this state.
The problem seems to be that the data store provider is somehow getting lost or stepped on, and this is impacting the ability to do things through EntityFrameworks.
I'm looking for some advice on where to look for these being stored, if anyone has run across something similar, and if there's any useful suggestions or ideas you think I might try.
UPDATE -- While this tidbit did not solve my problem, it did make VS2010 more stable: Immediately after uninstalling of the .NET Connector, I checked under Control Panel's installed programs and found there was an older .NET Connector installed as well. I uninstalled that one from the control panel, rebooted, and then installed the new one. VS2010 now remembers the database provider for working with EntityFrameworks. Apparently I installed a newer MySQL Connector thinking it would uninstall the old one, instead they step all over each other.
Now I'm getting a System.ArgumentException
inside System.Data.Entity.dll
stating the slightly different message:
The specified store provider cannot be found in the configuration, or is not valid. System.ArgumentException: Unable to find the requested .Net Framework Data Provider. It may not be installed.
This happens at the System.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName)
method.
REVISION NOTE -- The reason for the strike-outs above is that VS2010 eventually did lose the settings again. But I was able to uninstall the .Net Connector from the control panel and reinstall the connector again, without a reboot, and got my data provider back again in the environment. This part of the problem is feeling more like a VS2010 bug than a .NET Connector issue.
回答1:
I had this same error after reinstalling windows, and forgetting to add the provider for SQlite.
It's here, and even though it doesn't mention it, it supports VS 2010 fully.
回答2:
The problem went away after significant updates -- it appeared it was an environment/driver bug after all.
回答3:
I just restarted my VS2010,and the error just went away!!
回答4:
Based on some of the comments on the net this could be related to the provider not being in the GAC.
It could also be that an old version is the GAC.
Check what is in the GAC, add the dll to the GAC if it is missing. Restart the machine after any changes in the GAC.
回答5:
I came across this error recently and after much restarting / reinstalling it turned out the issue was actually that the 'connector' user had insufficient privledges on a view.
回答6:
I fix error simply by restarting the IDE.
来源:https://stackoverflow.com/questions/4444742/error-175-the-specified-data-store-provider-cannot-be-found