MySQL outbound connection

Discussion in 'Site Programming, Development and Design' started by hadi2f, Sep 23, 2009.

  1. Hi,

    I'm trying your services for the first time and the first thing I needed was to establish a MySQL connection from my .NET webservice to my database hosted on another server. I have tried 2 different connection strings (my 2 databases are spread on 2 different servers) and both of them are returning the following error:

    MySql.Data.MySqlClient.MySqlException: Unable to connect to any of the specified MySQL hosts. ---> System.Security.SecurityException: Request for the permission of type 'System.Net.SocketPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

    I am using the MySQL connector adapter to connect directly to MySQL databases. The same webservice was hosted on GoDaddy and is working fine (with outbound database connections).

    Is there something I should do?

    Thank you
     
  2. FredC

    FredC Winhost Staff

    Last edited by a moderator: Oct 14, 2015
  3. Worked

    That seems to work.
    Thanks for the super-prompt reply!
     
  4. Greetings,

    I have been having trouble just getting the connection to the mySQL DB on a remote server to work. I keep getting:

    Line 34: <add assembly="ByteFX.MySqlClient, Version=0.7.6.15073, Culture=neutral, PublicKeyToken=F2FEF6FED1732FC1"/></assemblies></compilation>

    The BytFX.MySqlClient is the one that tech support suggested I try. I replaced the original MySql.Data.MySqlClient with the by by BytFX and copied the DLL to my project and referenced it from there but I still get the above error.

    I am using VS2008. Any ideas please?

    JHH
     
  5. Tech support replied with (sort of) the answer. When you move the ByteFX mySQL assembly (ByteFX.MySqlClient.dll) to your site, create a 'bin' directory in the root and place the dll in there. It should then be accessible. The previous post in this thread also mentioned you should place the following in your web.config file:

    <trust level="Full" />

    Everything works perfectly now.
     
  6. I'm using the normal MySQL connector. I just added <trust level="Full" /> to my web.config and it's working normally now.
     

Share This Page