views:

154

answers:

2

Can I simply change the connection string to point from my Test DB to my Production DB when I go live with my website and DAL generated via Subsonic?

When I try to push to my production servers the DAL still seems to be talking with my Test DB even though I have changed the connectionstring to a valid production DB that contains the identical Schema.

TIA

John

A: 

Change the connection string, rebuild, and xcopy.

CodeToGlory
Rebuild???? That kind've defeats the purpose of having a test server. Our change management process involves testing DLLs in test and then moving them to prod. Recompiling before pushing to prod seems wrong.
John
I am not sure why, but I have to sometimes rebuild one of my sites whenever I touch the connection string or the provider.
CodeToGlory
That is the same issue I am trying to resolve. Why do I sometimes need to rebuild to get the connectionstring to "take"
John
+2  A: 

Yes, you should only have to change the setting in your web.config and make sure that your web app reloads. (it should almost always reload when the web.config is changed or replaced but I have seen times when it won't, you can then restart it in IIS or try editing the web.config locally)

You shouldn't have to rebuild

James Avery
I've gone so far as to reboot the web server yet still it goes to the test DB instead of the Prod DB that is in the connectionstring / dataprovider. If I re-build with the new connection string it does go to the new DB but rebuilding before going to production just seems wrong.Is the connectionstring get built into the assemblies?
John
And you are changing the values in the web.config on the server? And the web.config isn't being compiled or anything in your deployment process?
James Avery
I am not changing the web.config on the production server (shouldn't have to). Our change management process is designed to not copy the web.config onto a production server of an existing web site. The Subsonic files and web site are seperate projects in my VS Solution.
John
I just tried re-building and re-deploying just the Subsonic generated DAL dlls. Now I get a "ConnectionString property has not been initialized" error.
John
ok, I am confused about your process. Where are you changing the provider and connection string for subsonic? Normally I store that in the web.config of the web site.
James Avery
If you have your SubSonic classes in a separate project referenced by a web project, Subsonic gets its settings from the web.config, not the app.config.
John Sheehan
I am storing them in the Web.Config. The only thing that is different between the prod and test web.configs is the connection string. The provider points to the correct connection string in prod and test. (The only diff is the actual database name in the connection string)
John
Do you by chance have both a web.config and an app.config in your project?
ranomore
And the provider configuration is in your web.config as well?
James Avery
The provider configuration is in the web.Config.The DAL (Subsonic generated code) is in a seperate project and it does have an app.config. I then reference the DAL from my main web project.
John
Unless you are loading it explicitly that app.config won't be read, only the settings in the web.config will be read.
James Avery
I am not deploying the app.config to the production sites. The only place that the DAL provider can get the connectionstring is from the web.config but I change the connection there and the DAL still uses the one that was in place when it was compiled. ... Wierd.
John