Reputation: 520
I have a site that uses Entity Framework DB first and I can run it on my local computer (dev computer) just fine. I have the edmx file and everything.
Today I deployed the site to go daddy and created a new DB using MSSQL. Now when the site tries to access the database I'm getting an error saying : The connection string 'PCsTranformedEntities' in the application's configuration file does not contain the required providerName attribute
At this point I'm lost. The provider name is not a valid thing inside the connection string and I clearly have it as part of the connection. Here is the entire thing from my web config (of course without my login info)
<add name="PCsTranformedEntities" connectionString="metadata=res://*/SiteModel.csdl|res://*/SiteModel.ssdl|res://*/SiteModel.msl;provider=System.Data.SqlClient;provider connection string="data source=******;initial catalog=PCsTransformed;persist security info=True;user id=j***;password=***;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
I've looked all over google:
Entity Framework: "ProviderName" in connection string required- all of the sudden?
http://www.sqlteam.com/forums/topic.asp?topic_id=179111
and a whole lot more but they seem to be pointing to what I already have. I have the provider name and this is the string created by Entity Frameowrk when I created the model from the DB.
I can access the DB from sql server 2012 just fine and even use my site locally.
So what am I missing here? Why would it run fine on my local computer but throw an error when it's live?
Upvotes: 4
Views: 3055
Reputation: 19
I had the similar problem hosted with godaddy server. Every time I deploy to the server, it was changing the CAS and I had to go to asp.net setting to change the CAS and it modifies the web.config. Later I updated the web.config for CAS as then I never had to update CAS.
Upvotes: 0
Reputation: 520
I have found the error after searching for a while.
The error comes from go daddy altering the web config file.
Go daddy has a feature where you can click asp.net settings in order to set the CAS level. In this it also shows your connection strings from the web config file.
I had to update the CAS to Full for my site to work so I set it here but it seems when you change anything using go daddy's asp settings page, it will override the web config and alter it for you.
That's good for setting the CAS and such but bad when it also overrides the connection strings and removes things like the provider name.
Basically when I changed the CAS level, it altered my connection strings as well and removed the provider name attribute without me knowing. So if you host with go daddy, do not use their interface. Change the web config manually then upload it to the server. :)
Upvotes: 4