在asp.net项目中使用Mysql时出错 [英] Error in using Mysql in asp.net project

查看:62
本文介绍了在asp.net项目中使用Mysql时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友,
我在Myasp.net项目中使用Mysql作为数据库.当我运行项目时,它向我显示此错误.

Hello friends ,
I am using Mysql as database in my asp.net project. it is showing me this error when I run the project.

'Could not load file or assembly 'MySql.Data, Version=5.2.2.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. The system cannot find the file specified.'


这是我的WebConfiguration文件


This is my WebConfiguration file

<!-- 
    Note: As an alternative to hand editing this file you can use the 
    web admin tool to configure settings for your application. Use
    the Website->Asp.Net Configuration option in Visual Studio.
    A full list of settings and comments can be found in 
    machine.config.comments usually located in 
    \Windows\Microsoft.Net\Framework\v2.x\Config 
-->
<configuration>
	<appsettings>
		<add key="dbconnection" value="Database=blank;Data Source=208.91.198.100;User ID=bit;Password=book" />
		<!--<add key="dbconnection" value="Database=booksorbitblank;Data Source=localhost;User ID=root;Password=" />-->
		<!--<add key="dbconnection" value="Database=yesplus;Data Source=localhost;User ID=navneet;Password=ombooks" />-->
	</appsettings>
	<!--<connectionstrings>
    <add name="vtsConnection2" connectionstring="server=NAVNEET\SA;uid=sa;pwd=;database=vts">
     providerName="System.Data.SqlClient" />
  </add></connectionstrings>-->
	<system.web>
		<httpruntime executiontimeout="1000" maxrequestlength="1048576" />
		<!-- 
            Set compilation debug="true" to insert debugging 
            symbols into the compiled page. Because this 
            affects performance, set this value to true only 
            during development.

            Visual Basic options:
            Set strict="true" to disallow all data type conversions 
            where data loss can occur. 
            Set explicit="true" to force declaration of all variables.
        -->
		<compilation debug="true" strict="false" explicit="true" targetframework="4.0">
			<assemblies>
				<add assembly="MySql.Data, Version=5.2.2.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
				<add assembly="MySql.Data, Version=5.2.2.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D" />
				<add assembly="MySql.Data, Version=5.2.2.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D" />
				<add assembly="MySql.Data, Version=5.2.2.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D" />
				<add assembly="MySql.Data, Version=5.2.5.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D" />
				<add assembly="System.Data.OracleClient, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
				<add assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
				<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
				<add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
				<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
				<add assembly="Microsoft.VisualC, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
				<add assembly="System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
				<add assembly="System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
				<add assembly="System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" /></assemblies>
		</compilation>
		<httphandlers>
			<!--<add verb="GET" path="ScriptResource.axd" type="Microsoft.Web.Handlers.ScriptResourceHandler" validate="false" />-->
		</httphandlers>
		<pages enableviewstatemac="false" controlrenderingcompatibilityversion="3.5" clientidmode="AutoID">
			<!--<namespaces>
				<clear />
				<add namespace="System" />
				<add namespace="System.Collections" />
				<add namespace="System.Collections.Specialized" />
				<add namespace="System.Configuration" />
				<add namespace="System.Text" />
				<add namespace="System.Text.RegularExpressions" />
				<add namespace="System.Web" />
				<add namespace="System.Web.Caching" />
				<add namespace="System.Web.SessionState" />
				<add namespace="System.Web.Security" />
				<add namespace="System.Web.Profile" />
				<add namespace="System.Web.UI" />
				<add namespace="System.Web.UI.WebControls" />
				<add namespace="System.Web.UI.WebControls.WebParts" />
				<add namespace="System.Web.UI.HtmlControls" />
				<add namespace="vts_dal" />
				<add namespace="Bal" />
			</namespaces>-->
		</pages>
		<!--
            The <authentication> section enables configuration 
            of the security authentication mode used by 
            ASP.NET to identify an incoming user. 
        -->
		<!--<authentication mode="Windows" />-->
		<!--
            The <customerrors> section enables configuration 
            of what to do if/when an unhandled error occurs 
            during the execution of a request. Specifically, 
            it enables developers to configure html error pages 
            to be displayed in place of a error stack trace.

        <customerrors mode="RemoteOnly" defaultredirect="GenericErrorPage.htm">
            <error statuscode="403" redirect="NoAccess.htm" />
            <error statuscode="404" redirect="FileNotFound.htm" />
        </customerrors>
        -->
		<customerrors mode="Off">
		</customerrors>
		<authentication mode="Forms">
			<forms name="Mycook" path="/" loginUrl="UserLogin.aspx" timeout="12200">
				<credentials passwordformat="Clear">
				</credentials>
			</forms>
		</authentication>
		<sessionstate mode="InProc" timeout="12200" />
	</customerrors></authentication></system.web>
	<system.web>
		<authorization>
			<allow users="*" />
		</authorization>
	</system.web>
	<location path="MyAccount.aspx">
		<system.web>
			<authorization>
				<deny users="?" />
			</authorization>
		</system.web>
	</location>
	<location path="ShoppingCart.aspx">
		<system.web>
			<authorization>
				<deny users="?" />
			</authorization>
		</system.web>
	</location>
	<location path="WishList.aspx">
		<system.web>
			<authorization>
				<deny users="?" />
			</authorization>
		</system.web>
	</location>
</configuration>


请帮我.预先感谢朋友.


Please help me. Thanks in advance friends.

推荐答案

请确保在全局程序集缓存中安装的MySql.Data.dll版本不应该不同或不正确. >
还要确保您的Projects文件夹中的MySql.Data DLL具有正确的版本(5.2.2.0).
Make sure that there should not be a different or incorrect version of MySql.Data.dll installed in the Global Assembly Cache.

Also make sure that MySql.Data DLL in your Projects folder is with the correct version (5.2.2.0).


这篇关于在asp.net项目中使用Mysql时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆