I have an app that is called on a remote web hosting server. It calls up customer details and amends records in response to notification of a sale. It used to work fine but recently it does not.
The exception is:
System.ArgumentException: The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid.
at System.Data.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString)
at System.Data.Objects.ObjectContext.CreateEntityConnection(String connectionString)
at GSnet.Models.GreenhillSoftwareEntities..ctor() in C:\Users\Mike\source\repos\GSnetA\Models\GsEntityModel1.Designer.cs:line 50
at GSnet.GSData.ProcessPurchase(Transaction payPalTransaction) in C:\Users\Mike\source\repos\GSnetA\GSData.cs:line 58
I have double checked the connection string and cannot see anything wrong with it. Here it is below with XXXs replacing sensitive data.
<add name="xxxxSoftwareEntities"
connectionString="metadata=res://*/Models.GsEntityModel.csdl|res://*/Models.GsEntityModel.ssdl|res://*/Models.GsEntityModel.msl;provider=System.Data.SqlClient;provider connection string="data source=xxxxx.net;initial catalog=xxxxx_db;user id=greenhi1;password=xxxxx;multipleactiveresultsets=True;App=EntityFramework""
providerName="System.Data.EntityClient" />
If I run it on my dev machine to debug it calls the remote database quite happily but when the same code and the same connection string are on the remote hosting server then it falls over the first time it calls for any data.
I have racked my brain to remember any significant changes, consulting my GIT history etc. but I am stumped.
Can anyone give me any pointers?
I have tried recopying both the code and the connections string/web.config to the server and added some logging so I know which version of the code is running. It still failed.
System.Data.SqlClientinstead ofMicrosoft.Data.SqlClient? What versions ofSystem.Data.SqlClientdo you have installed locally and remotely?.udlNow doubleclick on that file from windows explorer, now you have a tool that can assist a little in building a working connection string. When you get it working in this tool, then open the udl text file with notepath and you will get the connectionstring as text again