My development server died so I am getting set up on a new machine with an archived copy of all the files from that server. I am running Umbraco 7.2.8. The database engine is SQL Server Express. I have downloaded the database from the working web site and am able to connect on the new machine.
The following code gets two different items of data:
@{
var theGetter = new readingGetter();
var theReading = theGetter.getReading();
var allBlogPosts = Umbraco.TypedContentAtXPath("//Blogitem").Reverse();
}
The problem is that these calls seem to be accessing two different data bases. The call to get readings performs correctly. It reads the newly downloaded database and returns the expected values.
The XPath query returns values from an old database version that was on the now dead server.
This is how the readingGetter connects to the DB:
private UmbracoDatabase theDB;
public readingGetter() {
theDB = ApplicationContext.Current.DatabaseContext.Database;
}
Obviously, the XPath query is hitting some cached value but I have no idea where that might be or how to clear it.
OK, I found the cached information in App_Data\umbraco.config. Now the question is why does it not update or how do I get it to reflect the newer database?
If you delete the umbraco.config file you referenced and restart the site it will re-generate off of your database. Alternatively, you can login to the back office, right click on your root node in your content tree and tell it to re-published including descendents.
The Umbraco.Config file is a cache of all published content and is the recommended entry point for accessing pages for the front end of the site. It is not recommended to directly access the Umbraco database, especially for content pages.
Database Problem
Hello
My development server died so I am getting set up on a new machine with an archived copy of all the files from that server. I am running Umbraco 7.2.8. The database engine is SQL Server Express. I have downloaded the database from the working web site and am able to connect on the new machine.
The following code gets two different items of data:
@{
var theGetter = new readingGetter();
var theReading = theGetter.getReading();
var allBlogPosts = Umbraco.TypedContentAtXPath("//Blogitem").Reverse();
}
The problem is that these calls seem to be accessing two different data bases. The call to get readings performs correctly. It reads the newly downloaded database and returns the expected values.
The XPath query returns values from an old database version that was on the now dead server.
This is how the readingGetter connects to the DB:
private UmbracoDatabase theDB;
public readingGetter() { theDB = ApplicationContext.Current.DatabaseContext.Database; }
Obviously, the XPath query is hitting some cached value but I have no idea where that might be or how to clear it.
Thanks for any help.
Update
OK, I found the cached information in App_Data\umbraco.config. Now the question is why does it not update or how do I get it to reflect the newer database?
Hi Jon,
If you delete the umbraco.config file you referenced and restart the site it will re-generate off of your database. Alternatively, you can login to the back office, right click on your root node in your content tree and tell it to re-published including descendents.
The Umbraco.Config file is a cache of all published content and is the recommended entry point for accessing pages for the front end of the site. It is not recommended to directly access the Umbraco database, especially for content pages.
Thanks
Nik
Thank you, Nik.
is working on a reply...