Search code examples
c#asp.netsql-serveramazon-web-servicesamazon-rds

How to configure connection string to RDS Instance (MSSQLServer Express)


I have connected from my PC to my instance RDS (MSSQL Server Express) using Managment Studio without problems, because I have already configured the policy groups and other stuff.

My "simple" problem is when I try to connect from my WebApp, I have a web.config and this is my configuration in ASP.NET MVC 5 Project... very easy:

Can you help to configure my connection string correctly?

Thanks!!

<add name="Entities" connectionString="metadata=res://*/Business.Interactive.Model.csdl|res://*/Business.Interactive.Model.ssdl|res://*/Business.Interactive.Model.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=aa1XXXXXXXXXbi.cruXXXXXXym4.eu-west-1.rds.amazonaws.com:1433;Database=Business.interactive.gci;User Id=userroot;
Password=XXXXXXXX;pooling=False;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
<add name="myBusinessContext" connectionString="Data Source=aa1XXXXXXXXXbi.cruXXXXXXym4.eu-west-1.rds.amazonaws.com:1433;Database=Business.interactive.gci;User Id=userroot;
Password=XXXXXXXX;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />

Solution

  • Ok, The problem was the length of the name of the database and I also I had to delete the number port:

    Finally:

    <add name="Entities" connectionString="metadata=res://*/Business.Interactive.Model.csdl|res://*/Business.Interactive.Model.ssdl|res://*/Business.Interactive.Model.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=aa1XXXXXXXXXbi.cruXXXXXXym4.eu-west-1.rds.amazonaws.com;Database=Businessgci;User Id=userroot;
    Password=XXXXXXXX;pooling=False;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
    <add name="myBusinessContext" connectionString="Data Source=aa1XXXXXXXXXbi.cruXXXXXXym4.eu-west-1.rds.amazonaws.com;Database=Businessgci;User Id=userroot;
    Password=XXXXXXXX;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
    

    Regards!!