Connected .NET Web Service to MySQL database
Wow, I did it. I finally connected .NET Web Service to MySQL database! It only took me 6 hours to research, rewrite, and compile. Good learning experience.
Just as a reference, I was using the MySQL.Data.DLL from the MySQL website and getting this error:
I contacted GoDaddy, and they sent me to the article below, but it doesn't tell you how to eliminate this error and it refers to connecting to MySQL from your development machine - remotely.
No help at all. So I kept researching on my own and figured it out. So the solution I found online was to recompile the MySQL connector source code (found on the MySQL site) with the AllowPartiallyTrustedCallers setting to allow MySQL to run under medium trust - which is what GoDaddy requires.
Here's GoDaddy's artcle on how to do this:
I emailed myself a copy of the MySQL .NET Connector version 6.4.4 recompiled to work with GoDaddy. If you need it just email me at vivortiz@yahoo.com. I'm not like others, I'd be happy to share.
Here's the test web service link: visotech.info/syf_ws/service1.asmx
Run the "MySqlTestConnectorNet_6_4_4" web service to see this new compiled DLL in action.
You can see that the .NET web service is hitting my test database.
The web service is on GoDaddy and connecting to MySQL on GoDaddy and running the following SQL:
Phew......
Vivian
Just as a reference, I was using the MySQL.Data.DLL from the MySQL website and getting this error:
System.Security.SecurityException: That assembly does not allow partially trusted callers.I contacted GoDaddy, and they sent me to the article below, but it doesn't tell you how to eliminate this error and it refers to connecting to MySQL from your development machine - remotely.
Connecting to a MySQL Database Using ASP.NET:No help at all. So I kept researching on my own and figured it out. So the solution I found online was to recompile the MySQL connector source code (found on the MySQL site) with the AllowPartiallyTrustedCallers setting to allow MySQL to run under medium trust - which is what GoDaddy requires.
Here's GoDaddy's artcle on how to do this:
How do I recompile the MySQL library to run under medium trust?:
http://support.godaddy.com/help/1496/how-do-i-recompile-the-mysql-library-to-run-under-medium-trustI emailed myself a copy of the MySQL .NET Connector version 6.4.4 recompiled to work with GoDaddy. If you need it just email me at vivortiz@yahoo.com. I'm not like others, I'd be happy to share.
Here's the test web service link: visotech.info/syf_ws/service1.asmx
Run the "MySqlTestConnectorNet_6_4_4" web service to see this new compiled DLL in action.
You can see that the .NET web service is hitting my test database.
The web service is on GoDaddy and connecting to MySQL on GoDaddy and running the following SQL:
select * from testonePhew......
Vivian


Comments