无法加载 mysql.web 程序集
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17436446/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Can't load mysql.web assembly
提问by Kraishan
I am making a web application with ASP.net MVC3. I eventually want to use roleprovider and authentication used by a login form. So I have this code:
我正在使用 ASP.net MVC3 制作一个 Web 应用程序。我最终想使用登录表单使用的角色提供程序和身份验证。所以我有这个代码:
<authentication mode="Forms">
<forms loginUrl="~/Home/Login" timeout="2880" />
</authentication>
<roleManager enabled="true" defaultProvider="MyRoleProvider">
<providers>
<add name="MyRoleProvider"
type="StudentAdministratieProject.Authorisation.CustomRoleProvider"/>
</providers>
</roleManager>
This code is obviously located in my web.config.
这段代码显然位于我的 web.config 中。
The error I get when I start the application:
启动应用程序时出现的错误:
Can't load file or assembly MySql.Web, Version=6.7.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d or one of the dependencies can't be loaded. The system cannot find the given file. ** Note that this is roughly translated from Dutch, the error was originally in Dutch.
无法加载文件或程序集 MySql.Web,Version=6.7.4.0,Culture=neutral,PublicKeyToken=c5687fc88969c44d 或无法加载依赖项之一。系统找不到给定的文件。** 请注意,这是从荷兰语粗略翻译的,错误最初是荷兰语。
Any ideas? Ive Googled a lot but can't find anything which helped me!
有任何想法吗?我用谷歌搜索了很多,但找不到任何对我有帮助的东西!
回答by hubson bropa
realize this is old, but in case its viewed later, here's what I found is cause / resolution.
意识到这是旧的,但如果以后查看它,我发现这是原因/解决方案。
I had to do some MySQL work on my regular .NET web server (db and web servers on same machine) so I used the MySQL installer (http://dev.mysql.com/tech-resources/articles/mysql-installer-for-windows.html). That little sucker seems to have gone and updated my .NET machine.config for me, how nice, so it's connector will work well with .NET. Stupid installer. Anyways when I went to go use a .NET / SQL Server app (no tie in to MySQL) I got the same error.
我不得不在我的常规 .NET web 服务器(同一台机器上的 db 和 web 服务器)上做一些 MySQL 工作,所以我使用了 MySQL 安装程序(http://dev.mysql.com/tech-resources/articles/mysql-installer- for-windows.html)。那个小傻瓜似乎已经为我更新了我的 .NET machine.config,多好,所以它的连接器可以很好地与 .NET 配合使用。愚蠢的安装程序。无论如何,当我去使用 .NET/SQL Server 应用程序(与 MySQL 无关)时,我遇到了同样的错误。
Easy enough fix (and your MySQL utilizing apps should still work just fine). Just comment out the MySQL reference(s) in the appropriate .NET framwework machine.config.
足够简单的修复(并且您使用 MySQL 的应用程序应该仍然可以正常工作)。只需在相应的 .NET 框架 machine.config 中注释掉 MySQL 引用即可。
NOTE: the web page the error is on will tell you what machine.config file (and line number) is offending.
注意:错误所在的网页会告诉你什么 machine.config 文件(和行号)有问题。
Link below is more detailed:
下面的链接更详细:
回答by Sunny Sharma
My Solution to this question as I do had the same issue:
我对这个问题的解决方案,因为我有同样的问题:
Just add a reference to MySql.Web and it will go.
只需添加对 MySql.Web 的引用,它就会消失。
回答by Sachin Dhir
Try reinstalling MySQL .NET Connector 6.9.4 while uncheck “Web Providers” during the installation -
尝试重新安装 MySQL .NET Connector 6.9.4,同时在安装过程中取消选中“Web Providers” -
See more at: [ASP.NET with MySQL: Configuration Error (MySql.Web.v20)][1] http://technowide.net/2014/11/07/asp-net-with-mysql-configuration-error/
查看更多信息:[ASP.NET with MySQL: Configuration Error (MySql.Web.v20)][1] http://technowide.net/2014/11/07/asp-net-with-mysql-configuration-error/
回答by Dumindu Lathpandura
I have experienced the same situation and managed to fix the problem with these steps,
我遇到过同样的情况并设法通过这些步骤解决了问题,
- Read the error information carefully which provides helpful details to rectify the situation.
- I wouldn't change the machine.config file.
- As it says Application cannot find a reference to the assembly MySql.Web and the version it is trying to reference is Version=6.7.4.0.
- Based on path you install MySql you will be able to find the correct assembly files, ex : C:\Program Files\MySQL\Connector NET 6.7.4\Assemblies\v4.0\MySql.Web.dll
- Copy C:\Program Files\MySQL\Connector NET 6.7.4\Assemblies\v4.0\MySql.Web.dll file to bin folder. (I would copy all the files in C:\Program Files\MySQL\Connector NET 6.7.4\Assemblies\v4.0\ folder to bin folder)
- 仔细阅读错误信息,其中提供了有用的详细信息来纠正这种情况。
- 我不会更改 machine.config 文件。
- 正如它所说,应用程序找不到对程序集 MySql.Web 的引用,它试图引用的版本是 Version=6.7.4.0。
- 根据您安装 MySql 的路径,您将能够找到正确的程序集文件,例如:C:\Program Files\MySQL\Connector NET 6.7.4\Assemblies\v4.0\MySql.Web.dll
- 将 C:\Program Files\MySQL\Connector NET 6.7.4\Assemblies\v4.0\MySql.Web.dll 文件复制到 bin 文件夹。(我会将 C:\Program Files\MySQL\Connector NET 6.7.4\Assemblies\v4.0\ 文件夹中的所有文件复制到 bin 文件夹中)
Hope this helps! Thanks
希望这可以帮助!谢谢
回答by merlintintin
Another solution:
另一种解决方案:
- check version of .NET used by application pool of your web application. here we consider version is 2.0
- go to folder C:\Program Files (x86)\MySQL\Connector NET 6.7.4\Assemblies\v2.0 (<- depend of your version)
- copy dll from previous folder to C:\Windows\assembly
- 检查 Web 应用程序的应用程序池使用的 .NET 版本。这里我们认为版本是 2.0
- 转到文件夹 C:\Program Files (x86)\MySQL\Connector NET 6.7.4\Assemblies\v2.0(<- 取决于您的版本)
- 将 dll 从上一个文件夹复制到 C:\Windows\assembly
回答by Muneeswari
As Beginner to .NET, i also experienced the same situation..
作为 .NET 的初学者,我也遇到过同样的情况。
But it can be resolved very simple step.
但是很简单的一步就可以解决。
Select references from solution explorer . Right click on it, Select Add reference, select mysql.web from the list of assemblies, then add it.
从解决方案资源管理器中选择参考。右键单击它,选择添加引用,从程序集列表中选择 mysql.web,然后添加它。
After adding mysql.web assembly , you can get rid out from this error.
添加 mysql.web assembly 后,您可以摆脱此错误。
Thanks!!
谢谢!!
回答by Dampas
I have been looking for answer and I find the solution that work for me on fix-for-mysql-connectornet-693
我一直在寻找答案,我在fix-for-mysql-connectornet-693上找到了对我有用的解决方案
You just need to delete ".v20" from every instance of MySql.Web.v20 in
您只需要从 MySql.Web.v20 的每个实例中删除“.v20”
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config
and
和
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config
You can edit files in Notepad (Run As Administrator!).
您可以在记事本中编辑文件(以管理员身份运行!)。
回答by Davut Gürbüz
For upgrading latest version and solving these kind of issues;
用于升级最新版本并解决此类问题;
Under Nuget Manager Console run
在 Nuget 管理器控制台下运行
PM> Install-Package MySql.Web
PM> Install-Package MySql.Web
this will download latest MySql.Web for you. From project references find dll version by looking its properties.
这将为您下载最新的 MySql.Web。从项目引用中通过查看其属性来查找 dll 版本。
Then,change any other version in your web.config with this new version. This works.
然后,使用此新版本更改 web.config 中的任何其他版本。这有效。
回答by Sean Dooley
I managed to resolve this by running MySQL Installer and updating to the latest files available.
我设法通过运行 MySQL 安装程序并更新到可用的最新文件来解决此问题。