简体   繁体   中英

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.

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 :)

Similar problems can be a trouble with security groups. My answer at this link can help someone

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM