Today is my nightmare day. I am successfully working on code development at the local level, and everything goes well when my db is discarded and recreated as necessary when changing the model. However, trying to "upgrade" the project to the sqlserver2008 intermediate server on mydiscountasp.net, my problems started in earnest. Since the sharing databases cannot be deleted / recreated by the user, I took a local backup and restored it to the server. One step closer. I see the database when I enter the server through sqlserver mgt studio and everything looks fine. However, I cannot figure out how to connect to the database through web.config. I started using the modest sysntax ado.net for a connection string line by line:
<add name="MyWebSiteContext" connectionString="Server=esql2k123.discountasp.net; Database=SQL2008R2_123456_test;uid=SQL2008R2_123456_test_user;pwd=mypassword;" providerName="System.Data.SqlClient"/>
this did not work and gave an error saying that the keyword "server" was not recognized. after a lot of searching, it looks like the problem might be related to the providerName="System.Data.SqlClient" .
So, changing this to providerName="System.Data.EntityClient" , I was a little scared. Alas, the same story.
To shorten the (very) long history, I have tried many permutations (mutations are the operational word !! :)), but it may not seem that they meet the correct syntax requirement for the first ef connectionstring requirement.
Has anyone there recently gone through a similar hoop and found a working solution?
fingers, fingers and eyes xx'd ..
[UPDATE] I managed to get my connection string to work (ALMOST) by formatting it like this:
<add name="GBCWebSiteContext" connectionString="Data Source=esql2k123.discountasp.net;Initial Catalog=SQL2008R2_123456_test;Persist Security Info=True;MultipleActiveResultSets=True;User ID=SQL2008R2_123456_test_user;Password=mypass" providerName="System.Data.SqlClient"/>
Now I can stop and debug the action of the controller, as it performs linq selection. HOWEVER, when I try to return the rows, I get an exception that states: The trigger returns a result set, and the server parameter "disable results from triggers" is true
So, what is my last piece of the puzzle here, is an extra option in the connection string to negate this problem?
[UPDATE 2] Hallellulah - I chopped a nut. Since I relayed the global.asax line:
Database.SetInitializer(new System.Data.Entity.DropCreateDatabaseIfModelChanges<MyWebSiteContext>());
I did not understand that I need to include a null reference to Database.SetInitializer() .
So here is the following sorting of my problem:
Database.SetInitializer<MyWebSiteContext>(null);
Thanks to everyone for the various suggestions, they helped me focus on the problem. So happy :)