2
votes

I am using Entity Framework in a MVC web application. My database is in azure and I am deploying my web app to azure. But when I deploy the application I receive the error below. I do NOT receive this error while debugging even though I am connecting to the same database.

Error

Keyword not supported: 'data source'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentException: Keyword not supported: 'data source'.

Conn String

<add name="SoccerEntities" 
     connectionString="metadata=res://*/Models.MyModel.csdl
                               |res://*/Models.MyModel.ssdl
                               |res://*/Models.MyModel.msl;
                       provider=System.Data.SqlClient;
                       provider connection string='server=tcp:<servername>,1433;
                                                   initial catalog=MyDB;
                                                   persist security info=True;
                                                   user id=user;
                                                   password=pwd;
                                                   MultipleActiveResultSets=True;
                                                   App=EntityFramework'" 
                        providerName="System.Data.EntityClient" />    
1
You don't have "data source" in your connection string. Are you doing anything special in code with it? Or do you have a config transform for the deployment? - DavidG
No config transform. I have made sure to remove all references to 'data source' in my web.config - ExceptionLimeCat
So, in Azure, have you configured a connection string named "SoccerEntities"? - CodeCaster
No I haven't configured a connection string in azure. I have configured the database it should be connecting to. - ExceptionLimeCat
I'd double check the generated code within the .edmx and .designer.cs - I believe these used to include a hard-coded value of the connection string that might be used instead of the value in the web.config. Another issue might be with the encoding of characters within your username or password - that could be breaking the string. - Zhaph - Ben Duguid

1 Answers

-1
votes

Found the answer. Apparently there are some default connections strings set in the Azure IIS Web App out-of-the-box. I'm not sure why my Web.config wasn't overriding these settings but it wasn't. I had to set a default conn string in the admin panel.

In Azure Admin Panel:

Select App -> Application Settings -> Enter new Connection String -> Save