Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jon Behrens 11 posts 131 karma points
    Sep 04, 2023 @ 21:04
    Jon Behrens
    0

    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.

  • Jon Behrens 11 posts 131 karma points
    Sep 05, 2023 @ 04:22
    Jon Behrens
    0

    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?

  • Nik 1614 posts 7260 karma points MVP 7x c-trib
    Sep 05, 2023 @ 08:55
    Nik
    100

    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

  • Jon Behrens 11 posts 131 karma points
    Sep 05, 2023 @ 14:48
    Jon Behrens
    0

    Thank you, Nik.

Please Sign in or register to post replies

Write your reply to:

Draft