4

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=&quot;data source=******;initial catalog=PCsTransformed;persist security info=True;user id=j***;password=***;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />

I've looked all over google:

Entity Framework: "ProviderName" in connection string required- all of the sudden?

The connection string 'MyConnection' in the application's configuration file does not contain the required providerName attribute."

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?

Community
  • 1
  • 1
Jeremy Styers
  • 497
  • 5
  • 23
  • How do you deploy your app. Are You sure that you have all required assemblies? – rraszewski Jan 27 '15 at 06:22
  • I ftp into the site and copy the files over using winscp. I'm thinking it may be an assembly but not sure which would be the culprit in this case. I know i had to copy MVC assemblies to go daddy before it would run my site (said it didn't know what MVC was) but this isn't acting like it doesn't know what I'm talking about. It's acting like I'm doing something wrong. Would you know which assembly would cause this error? Maybe it's out of date on go daddy's servers? :\ – Jeremy Styers Jan 27 '15 at 06:30
  • I think that you should create **publish package** and upload it using IIS server. I've never used goddady webhosting but I've noticed that they have very nice support. https://support.godaddy.com/help/article/6639/using-mvc3-applications-on-your-hosting?countrysite=pl https://support.godaddy.com/help/article/8999/do-your-hosting-accounts-support-mvc4-and-mcv5-applications?countrysite=pl – rraszewski Jan 27 '15 at 06:43
  • What is the version of the SQL Server instance at GoDaddy that is hosting your database? – Rhys Jones Jan 27 '15 at 08:15
  • I don't know if it is just your formatting for this site, but you have this suspect in your string: `connection string="` Make sure it's being read as a real " and try to use ' instead to see – Allan S. Hansen Jan 27 '15 at 08:42

2 Answers2

4

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. :)

Jeremy Styers
  • 497
  • 5
  • 23
  • When I manually change the web config and upload via ftp, I get the CAS security warning. How did you overcome that? – tintyethan May 05 '15 at 22:13
  • ok - I got it. the documentation for trust level on msdn is wrong. You have to just add to the node and manually upload via ftp like you said. – tintyethan May 05 '15 at 22:26
0

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.

Santosh
  • 19
  • 2
  • 6