• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1275
  • Last Modified:

MySql on server

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
nuritat
Asked:
nuritat
  • 7
  • 5
1 Solution
 
Kevin CrossChief Technology OfficerCommented:
nuritat:

Do you have the .NET connector on the server?

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

Regards,

--isa
0
 
nuritatAuthor Commented:
Thank you very much
I think I resolvd the problem myself
(something wrong with my connectionstring)


0
 
nuritatAuthor Commented:
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
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
Kevin CrossChief Technology OfficerCommented:
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
 
nuritatAuthor Commented:
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
 
Kevin CrossChief Technology OfficerCommented:
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
 
nuritatAuthor Commented:
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
 
Kevin CrossChief Technology OfficerCommented:
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
 
nuritatAuthor Commented:
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
 
nuritatAuthor Commented:
The solution was not comlete because I resolved the problem myself
0
 
Kevin CrossChief Technology OfficerCommented:
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
 
nuritatAuthor Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 7
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now