Llm
Llm

Reputation: 147

How to set a proper connection string for Azure database?

I have an azure website and database. I'm running an ASP.NET MVC 4 / EF 5 app localy and trying to put some data to the azure database before to deploy the app. But I have a TargetInvocationException : {"The ASP.NET Simple Membership database could not be initialized. For more information, please see http://go.microsoft.com/fwlink/?LinkId=256588"} Keyword not supported : server

This is the connection string that I get from my azure dashboard :

    <add name="myconstring" connectionString=Server=tcp:myserver.database.windows.net,1433;Database=mydatabase;User ID=cdptest@myserver;Password=******;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;" providerName="System.Data.EntityClient" />

I tried this I got "Keyword not supported : data source"

    <add name="myconstring" connectionString="Data Source=myserver.database.windows.net;Initilal Catalog=mydatabase;User ID=cdptest@myserver;Password=*****;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;" providerName="System.Data.EntityClient"/>

Upvotes: 2

Views: 6648

Answers (2)

Llm
Llm

Reputation: 147

OK the providername was wrong. System.Data.SqlClient was excepted as this is a code first app model. I probably got System.Data.EntityClient from another app with Model First or Database First...

Upvotes: 0

Mel Gerats
Mel Gerats

Reputation: 2262

The following works for me:

 <add name="coupdpoAPEkowswAEntities" connectionString="Server=tcp:myserver.database.windows.net,1433;Database=mydatabase;User ID=cdptest@myserver;Password=*****;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;" providerName="System.Data.EntityClient"/>

Use Server instead of Data Source, and specify the protocol and the port, and use Database instead of Initial Catalog

Upvotes: 3

Related Questions