I've got a web app that u开发者_如何转开发ses a MS SQL Server 2008 database. Recently I made two copies of the database, one for ongoing development, the other for users to begin testing and evaluting the application.
I've got two seperate web applications now. I've changed the web.config of the 'test' version to point to the test DB, but it still seems to be using the previous version.
Is this cached somewhere? I've run IISRESET on the box, but the the 'test' version of my web app still seems to point to the wrong DB.
This is driving me crazy, any help is appreciated.
Just a wild guess: Your connection string might not be configured where you think it is. Either you're changing the wrong connection string, or the connection string is not being read from web.config at all.
Configuration isn't cached anywhere, so when you change the connection string and start up your application, the changed value is loaded.
What does the part your data access code which creates the DB connection look like?
Make sure the connection string isn't anywhere else, like hibernate.config.
If you restored your test database from the original database and if you are using synonyms, then its possible that your synonyms' names have the full name, included the database name. Try to change these names deleting the database name from the synonyms' names!!! it will work!
As a complementary/additional note following the answer by @Maria, if you right-click on the restored [new] database (e.g. Test_DB), click on 'Files', and look at the 'Database Files', they may still be pointing to, for example, MAIN_DB and MAIN_DB.log. You may want to change these to, for example, TEST_DB and TEST_DB.log so your test database is actually pointing to the correct (test) data file. (However, this may only be one step out of a number of steps needed to point your test app to your test DB when you have restored your [live] database to a new [test] database.)
I have got the same problem. When I carefully checked my app I found out that I used two data access method. using entity framework as well as ADO.net in the same project.(I am not mush familiar with entity framework that is why I use two data access method).
精彩评论