Entity Framework 5 and Amazon RDS - “The underlying provider failed on Open.”

前端 未结 1 1274
生来不讨喜
生来不讨喜 2021-01-20 21:54

I have a C# / Entity Framework web application runs fine against a local SQL 2012 db. I copied the db out to a new RDS instance, and can access the db via Visual Studio and

相关标签:
1条回答
  • 2021-01-20 22:36

    The problem was in the connection string. Specifically, I had "Application Name" and "App" properties in there. Once I removed those, it worked.

    BAD:

    <add name="MyDbEntities" connectionString="metadata=res://*/MyDb.csdl|res://*/MyDb.ssdl|res://*/MyDb.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=MyDbServer;Initial Catalog=MyDb;Persist Security Info=True;User ID=MyDb;Password=MyPassword;Application Name=MyDb.API.Models;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
    

    GOOD:

    <add name="MyDbEntities" connectionString="metadata=res://*/MyDb.csdl|res://*/MyDb.ssdl|res://*/MyDb.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=MyDbServer;Initial Catalog=MyDb;Persist Security Info=True;User ID=MyDb;Password=MyPassword;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />
    
    0 讨论(0)
提交回复
热议问题