在google中找到答案后,我发现它可能与PC中的安装或项目引用有关。
但是, FW版本在我的电脑和笔记本电脑中是一样的,引用都被标记为copy-local(仅供测试!) / p>
还有什么可能导致这样的问题?我真的不知道...
更新
我发现我得到的错误是: 在配置中找不到指定的商店提供商,或无效。
我也通过在Google中进行更深入的搜索来解决这个问题。 解决方案可以在下面找到...
快乐编码!
解决方案我终于解决了!
这是怎么做的: 1)确保你的项目有一个对MySql.Data.dll,MySql.Web.dll,MySql.Data.Entity.dll和System.Data.Entity的引用.dll。
2)将以上所有内容全部复制到本地。
3)添加以下内容行到您的 App.config 文件:
< system.data> ; < DbProviderFactories> < clear /> < add name =MySQL数据提供者invariant =MySql.Data.MySqlClient description =。用于MySQL的Net Framework数据提供者 type =MySql.Data.MySqlClient .MySqlClientFactory,MySql.Data, Version = 6.4.4.0,Culture = neutral,PublicKeyToken = c5687fc88969c44d/> < / DbProviderFactories> < /system.data>4)点击MySQL.Data参考,并检查它的版本。您可以在选择它之后在解决方案资源管理器的属性窗口中找到。
5)更改 Version = 6.4.4.0 部分到您的MySql.Data.dll的版本。矿井是6.5.4.0,这是最新的,但是较旧的版本应该是一样好。
另外,我要感谢 Ralf de Kleine 和其他所有回答提出/提示异常代码的人。 当我们这么简单的时候,我不想考虑使用异常!
I have built a simple WPF application just to gain some experience with it. All it does is get information from a database when a user clicks on a button. The application works fine in my PC(using the publish option), but when I tried running it on my laptop and my friends' PC, the app crashed as fast as the button was pressed. I'm 99% sure it has something to do with Entity Framework, which I use to contact the database (all the the function that gets fired on the button click does is contact and retrieve info from the DB).
After looking for answers in google I found out that it may have something to do with either the installation in the PC, OR the project references.
However, the FW version is the same in my PC and my laptop, and the references were all marked as copy-local (just for testing!).
What else could cause such problem? I really have no idea anymore...
UPDATE
Using exceptions, I found out that the error I got was: The specified store provider cannot be found in the configuration, or is not valid.
I also solved this problem by searching deeper in Google. The solution can be found below...
Happy coding!
解决方案I finally solved it!
This is how to do it: 1) Make sure your project has a reference to MySql.Data.dll, MySql.Web.dll, MySql.Data.Entity.dll and System.Data.Entity.dll.
2) Set all of the above to Copy-Local.
3) Add the following lines to your App.config file:
<system.data> <DbProviderFactories> <clear /> <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.4.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" /> </DbProviderFactories> </system.data>4) Click on the MySQL.Data reference, and check it's version. It can be found in the 'Properties' window below the solution explorer after you select it.
5) Change the Version=6.4.4.0 part to the version of your MySql.Data.dll. Mine was 6.5.4.0 which is the newest but older versions should work just as fine.
Also, I'd like to thank Ralf de Kleine and everyone else who answered for putting up/suggesting the exception code. It was dumb of me to not think about using exceptions when they're just so convenient!
更多推荐
WPF应用程序在其他计算机上不起作用
发布评论