Cod*_*yon 17 c# asp.net asp.net-mvc asp.net-mvc-4
我正在创建一个MVC4 Web应用程序项目.当我使用空项目并只是在浏览器上运行它工作正常.但问题是当我正在尝试创建一个Internet应用程序项目而不是Empty project.Once我创建互联网应用程序项目,当试图在浏览器上运行它时,它显示以下配置错误.我明白这是与MySQL连接器程序集引用相关的东西.以下是错误.
Server Error in '/' Application.
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Could not load file or assembly 'MySql.Web.v20, Version=6.9.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. The system cannot find the file specified.
Source Error:
Line 265: <providers>
Line 266: <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="LocalSqlServer" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7" minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10" passwordStrengthRegularExpression=""/>
Line 267: <add name="MySQLMembershipProvider" type="MySql.Web.Security.MySQLMembershipProvider, MySql.Web.v20, Version=6.9.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="LocalMySqlServer" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="false" passwordFormat="Clear" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7" minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10" passwordStrengthRegularExpression=""/>
Line 268: </providers>
Line 269: </membership>
Source File: C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config Line: 267
Assembly Load Trace: The following information can be helpful to determine why the assembly 'MySql.Web.v20, Version=6.9.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' could not be loaded.
Run Code Online (Sandbox Code Playgroud)
Ogn*_*rov 43
当您安装MySQL .NET Connector 6.9.4(可能还有其他版本)时会发生这种令人讨厌的错误,因为如果您在安装过程中没有取消选中"Web Providers",它会在您的machine.config中写入,这会导致您出现此错误.在应用任何这些步骤之前,请务必阅读整个答案,以便从必须开始的地方开始.
其他建议的真正问题在于,如果你没有在每个项目中使用MySQL来添加对MySQL dll的引用来缓解每个项目中的问题都不是一个选择.使用ASP.NET的每个项目都需要它,因为安装程序在机器配置中添加了行!
要正确解决问题:
但如果你这样做,你可能会尝试添加Ado NET实体数据模型,对吧?如果是这种情况,很可能您没有在向导中看到MySQL作为可用数据源的选项.这是因为从版本6.7开始安装MySQL Connector .NET时,它将不再自动注册为DDEX提供程序.
要解决此问题,您必须从此处下载专门为MySQL和.NET提供的单独安装程序,或者直接从此处下载 Visual Studio集成插件.
请确保在上述任一安装程序的安装向导中检查Visual Studio集成和连接器.
小智 5
这个解决方案对我有用:
<siteMap>
<providers>
<remove name="MySqlSiteMapProvider"/>
</providers>
</siteMap>
Run Code Online (Sandbox Code Playgroud)
我想他们忘了把文件MySql.Web放在de GAC(全局程序集缓存)中
| 归档时间: |
|
| 查看次数: |
14716 次 |
| 最近记录: |