0

I am working on windows azure with asp.net mvc 3 web role. I am trying to list out all the records in my table by using ADO.NET Entity Framework. and i have used the following connection string to bind model.

<add name="CalMedEntities" connectionString="metadata=res://*/Models.CalMedModel.csdl|res://*/Models.CalMedModel.ssdl|res://*/Models.CalMedModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=STELLENT-PC.database.windows.net;initial catalog=CalMed;persist security info=True;user id=sa;password=#stellent10;multipleactiveresultsets=True;Encrypt=True;erverCertificate=False;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />

When i run my project at local its working fine in windows azure emulator. but I am getting an error

The underlying provider failed on Open.

after publishing my project to windows azure portal. please guide me.

Dmytro
  • 16,668
  • 27
  • 80
  • 130
Karthik Bammidi
  • 1,851
  • 9
  • 31
  • 65

2 Answers2

0

I think the connection string is not pointing to your Azure database but to yout local database. You need to set the connection with the one that Azure gives you

pollirrata
  • 5,188
  • 2
  • 32
  • 50
0

your connection string should look a bit like this (you'll get your database parameters from the azure portal):

<add name="CalMedEntities"
    connectionString="Server=tcp:u0ngf29abc.database.windows.net,1433;
    Database=myentities;User ID=youname-admin@u0ngf29abc;Password=mypassword;
    Trusted_Connection=False;Encrypt=True;
    MultipleActiveResultSets=True;PersistSecurityInfo=True;"
    providerName="System.Data.SqlClient" />
jim tollan
  • 22,305
  • 4
  • 49
  • 63