?
Solved

MySql on server

Posted on 2010-01-07
12
Medium Priority
?
1,258 Views
Last Modified: 2012-06-27
Hi,
I developed a page connected to MySql , it works perfect on my local host but gives an error on the hosting server:

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

I tryed to add in web.config:

<add assembly="MySql.Data, Version=5.1.5.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D"/>

but this result in another error:

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

Ehat should I do?
0
Comment
Question by:nuritat
  • 7
  • 5
12 Comments
 
LVL 60

Expert Comment

by:Kevin Cross
ID: 26201487
nuritat:

Do you have the .NET connector on the server?

http://dev.mysql.com/downloads/connector/net

Regards,

--isa
0
 

Author Comment

by:nuritat
ID: 26207357
Thank you very much
I think I resolvd the problem myself
(something wrong with my connectionstring)


0
 

Author Comment

by:nuritat
ID: 26276506
Sorry but I would like to reopen the question, it seems that what I thought will resolve my solution didn't solve it.
The .net connector version 5e xists on the server (the webmaster says there ary many other MySql connections) and I use in  my localhost version 6, it seems strange that the error I get refers to version 6 :

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

can anybody help?

thanks

 

0
Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

 
LVL 60

Expert Comment

by:Kevin Cross
ID: 26277596
If you developed this in .NET on a system with the version 6.x connector then your application would reference that version; therefore, when loaded on the remote server would fail as that assembly is not found.

You would have to rebuild your application using the version 5.x connector being used by the web host so that you are referencing the DLL that is available there.

Regards,

--isa
0
 

Author Comment

by:nuritat
ID: 26277664
thanks, I'll try that

should I first remove the MySql connecter version 6 from my PC? where can I download the version 5 connector?

Thanks
0
 
LVL 60

Expert Comment

by:Kevin Cross
ID: 26280134
You can pick older versions here:
http://dev.mysql.com/downloads/connector/net/6.0.html

You should not have to uninstall version 6.x.  Just remember when selecting the DLL from Visual Studio that you pick the 5.x version.  As long as you compile with the correct one you will be fine.  This allows you to use the newer version in projects where your target system can use the newer connector, but yet maintain this application.

HTH

--isa
0
 

Author Comment

by:nuritat
ID: 26281267
Hi,
I downloaded "mysql-connector-net-5.0.9-noinstall.zip ", opened it and put the MySql.Data.dll in my localhost bin directory then removed from the reference the MySql.data and re-added it from the bin directory, I recompied my progect and moved to the host ( on my localhost it still works perfect)
but again I get the error:

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

I tried to add the assembly line in my web.config, but then I get an error on that line

I'm close to be desperate...
Thanks
0
 
LVL 60

Accepted Solution

by:
Kevin Cross earned 750 total points
ID: 26285195
Which one does your host have loaded?
You may want to have them showing a working Web.Config since they are indicating others are not having issues, but from the sounds of it the issue is with the hosting environment.  Could be something silly like your web site isn't set as virtual app root (in IIS) so the BIN directory isn't being read from the location of your site as it would use BIN from the app root, so may need to see if they can set your site accordingly or place the appropriate DLL in the top level BIN directory.
0
 

Author Comment

by:nuritat
ID: 26290671
Thanks allot,
A friend came here yesterday and fixed the problem: he put the MySql.data.dll version 5.0.9 in the server's bin directory, added the assembly line needed in the web.config and took off the ProviderName from the connectionString and now it works

anyway I wish to award you the points for your effort
N.


0
 

Author Closing Comment

by:nuritat
ID: 31674050
The solution was not comlete because I resolved the problem myself
0
 
LVL 60

Expert Comment

by:Kevin Cross
ID: 26294849
Thanks.
Glad that worked.  Thought I suggested all that, but admittedly didn't think anything was wrong with your provider string given this worked locally.  Figured the main issue was getting the Web.Config using the right version and having the DLL in the appropriate BIN directory as I mentioned in the accepted post.

Will be good for future users to catch that extra point, so thanks for sharing.

Best regards and happy coding,

Kevin
0
 

Author Comment

by:nuritat
ID: 26301102
Hi again,

It seems that all is correct but unfortunately now the connection to the database works but the connection to a gridview (that worked before) doesn't work now

that may be connected to the fact that when I try to create a new data source connection I don't see the MySql database as an option

anyway everything works fine on my localhost

IAny idea??

Thanks
N.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this blog post, we’ll look at how ClickHouse performs in a general analytical workload using the star schema benchmark test.
In this blog post, we’ll look at how using thread_statistics can cause high memory usage.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question