Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connect to Amazon RDS with Entity Framework

I'm running a RDS MySQL server and is moving my current environment to this. I can connect fine with MySQL Workbench, but I'm getting the following, when trying to connect trough my .NET application with Entity Framework:

EntityException: The underlying provider failed on Open.
...
MySqlException (0x80004005): Unable to connect to any of the specified MySQL hosts.
...
SocketException (0x2af9): No such host is known

My connectionstring looks like this:

    <add name="MyEntities" connectionString="metadata=res://*/Database.csdl|res://*/Database.ssdl|res://*/Database.msl;provider=MySql.Data.MySqlClient;provider connection string=&quot;server=name.*.eu-west-1.rds.amazonaws.com,3306;user id=Username;password=Password;persist security info=True;database=DBName&quot;" providerName="System.Data.EntityClient" />

As I can connect in MySQL Workbench, I believe the Security Settings on AWS is correct. Hopefully some of you can point me in the right direction.

like image 514
Oxholm Avatar asked Jul 26 '15 00:07

Oxholm


1 Answers

Turns out, that if you leave the portnumber out of the connectionstring everything works out just fine. I think it's getting too late. At least I hope this helps someone :)

like image 200
Oxholm Avatar answered Sep 24 '22 14:09

Oxholm