+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Database missing error when upgrading to 4.1

Database missing error when upgrading to 4.1

17 posts, 0 answered
  1. Eric Zanol
    Eric Zanol avatar
    13 posts
    Registered:
    15 Mar 2011
    25 Apr 2011
    Link to this post
    I get the attached error (screenshot) when trying to upgrade a 4.0 SP1 project. If it matters, the project was working outside of the SF Project Manager, so I installed the Project Manager to perform the upgrade. Thanks in advance.

  2. Eric Zanol
    Eric Zanol avatar
    13 posts
    Registered:
    15 Mar 2011
    26 Apr 2011
    Link to this post
    Nevermind, started the upgrade over again. Got past a mismatching assembly reference by deleting ~/bin/migration.dll, and things are fine. For now. ;)
  3. Eric Zanol
    Eric Zanol avatar
    13 posts
    Registered:
    15 Mar 2011
    26 Apr 2011
    Link to this post
    Now when I click on any page to edit it in the control panel, I get an "Object reference not set to an instance of an object." error with the following stack trace:

    [NullReferenceException: Object reference not set to an instance of an object.]<br>   Telerik.Sitefinity.Modules.GenericContent.ContentManager.IsContentBlockHtmlObsolete(String serverSideControlID, Guid pageId, ContentLifecycleStatus clcStatus, CultureInfo culture, String pageProviderName) +108<br>   Telerik.Sitefinity.Modules.GenericContent.ContentManager.IsContentBlockHtmlObsolete(String serverSideControlID, Guid pageId, ContentLifecycleStatus clcStatus, CultureInfo culture) +49<br>   Telerik.Sitefinity.Modules.GenericContent.ContentManager.IsContentBlockHtmlObsolete(String serverSideControlID, Guid pageId, ContentLifecycleStatus clcStatus) +94<br>   Telerik.Sitefinity.Modules.GenericContent.Web.UI.ContentBlock.get_IsOutDated() +347<br>   Telerik.Sitefinity.Modules.GenericContent.Web.UI.ContentBlock.get_CustomMessages() +315<br>   Telerik.Sitefinity.Web.UI.ZoneEditor.CustomizeControlDockTitlebar(Control control, RadDock dock) +163<br>   Telerik.Sitefinity.Web.UI.ZoneEditor.AddControlDocksToZone(String placeHolderId, Control zone) +167<br>   Telerik.Sitefinity.Web.UI.ZoneEditor.ProcessPlaceholders() +131<br>   Telerik.Sitefinity.Web.UI.ZoneEditor.CreateChildControls() +88<br>   System.Web.UI.Control.EnsureChildControls() +181<br>   System.Web.UI.Control.PreRenderRecursiveInternal() +59<br>   System.Web.UI.Control.PreRenderRecursiveInternal() +221<br>   System.Web.UI.Control.PreRenderRecursiveInternal() +221<br>   System.Web.UI.Control.PreRenderRecursiveInternal() +221<br>   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4184

  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    26 Apr 2011
    Link to this post
    Hello Eric,

    There is an issue with upgrade of content blocks in Page Templates.

    To fix this, please run the query below against your DB and check if the issue still exists. The script will fix the error and remove the option to share the content block while it is used in a template.
    NOTE: Backup your database before you run the script.

    UPDATE[sf_object_data]
       SET[sf_object_data].object_type = 'Telerik.Sitefinity.Modules.GenericContent.Web.UI.ContentBlockBase'
       FROM[sf_object_data] INNERJOIN[sf_page_templates] ON[sf_object_data].page_id = [sf_page_templates].id
       WHEREobject_type = 'Telerik.Sitefinity.Modules.GenericContent.Web.UI.ContentBlock'
       GO
           
       UPDATE[sf_object_data] SET[sf_object_data].object_type = 'Telerik.Sitefinity.Modules.GenericContent.Web.UI.ContentBlockBase'
       WHEREoriginal_control_id in(SELECT[sf_object_data].id
                                     FROM[sf_object_data] INNERJOIN[sf_page_templates] ON[sf_object_data].page_id = [sf_page_templates].id
                                     WHEREobject_type = 'Telerik.Sitefinity.Modules.GenericContent.Web.UI.ContentBlockBase') AND
             object_type = 'Telerik.Sitefinity.Modules.GenericContent.Web.UI.ContentBlock'
       GO


    Let me know how it goes. Once again, use a backup of the database

    Best wishes,
    Ivan Dimitrov
    the Telerik team

  5. Eric Zanol
    Eric Zanol avatar
    13 posts
    Registered:
    15 Mar 2011
    26 Apr 2011
    Link to this post
    I'm not able to get it to run. Is it a problem that my database is an MDF in the App_Data folder? VS2010 keeps giving me a syntax error.
  6. Eric Zanol
    Eric Zanol avatar
    13 posts
    Registered:
    15 Mar 2011
    26 Apr 2011
    Link to this post
    VS2010 doesn't seem to like the "GO" so I took them out and ran them as two separate queries, one after the other. Each one said "0 rows affected...".
  7. Eric Zanol
    Eric Zanol avatar
    13 posts
    Registered:
    15 Mar 2011
    28 Apr 2011
    Link to this post
    Checking in to see if anyone's had a chance to look at this.
  8. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    02 May 2011
    Link to this post
    Hi Eric ,

    You can attach the mdf to the sql server and then create a backup.

    Greetings,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  9. Vivid Group
    Vivid Group avatar
    8 posts
    Registered:
    01 Dec 2009
    09 May 2011
    Link to this post
    I am having the same issue.

    Running the SQL script above does not resolve this issue.
  10. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    13 May 2011
    Link to this post
    Hello ,

    This error occurs because of the new shared content block behaviour. It has been resolved in 4.1 SP1 that is due to be released today (Friday). Some of your ContentBlock controls have no IDs (the ID property is deleted). That breaks Page Editor. As a workaround, you could run the following code which will set unique IDs for all ContentBlocks:

    Again, use database backup if you are not intending to upgrade to the 4.1 SP1.

    var manager = PageManager.GetManager();
    var controlType = typeof(ContentBlock).FullName;
    var propName = "ID";   
      
    var controls = manager.GetControls<PageControl>().Where(pc => pc.ObjectType == controlType);
    foreach (var cb in controls)
    {
        var idProp = cb.Properties.FirstOrDefault(p => p.Name == propName);
        if (idProp == null)
        {
            idProp = manager.CreateProperty();
            idProp.Name = propName;
            idProp.Value = Guid.NewGuid().ToString();
            cb.Properties.Add(idProp);
        }
    }
      
    var draftControls = manager.GetControls<PageDraftControl>().Where(pdc => pdc.ObjectType == controlType);
    foreach (var cb in draftControls)
    {
        var idProp = cb.Properties.FirstOrDefault(p => p.Name == propName);
        if (idProp == null)
        {
            idProp = manager.CreateProperty();
            idProp.Name = propName;
            idProp.Value = Guid.NewGuid().ToString();
            cb.Properties.Add(idProp);
        }
    }
      
    manager.SaveChanges();


    Greetings,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  11. Alex
    Alex avatar
    4 posts
    Registered:
    31 Aug 2010
    18 Jul 2011
    Link to this post
    I'm also having the issue noted above. Was there a resolution? Bear in mind I'm on 4.1 SP2 so I suspect it's not the same underlying issue.
  12. Stanislav Velikov
    Stanislav Velikov avatar
    1113 posts
    Registered:
    30 Nov 2016
    21 Jul 2011
    Link to this post
    Hello Alex,

    As mentioned above can you confirm your database is an .mdf file. If it is it is stored in Sitefinity App_Data folder which has different security than the rest of the folders in the site root. Can you make sure you grant the folder full permissions so the upgrade procedure can update the database.

    Greetings,
    Stanislav Velikov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  13. Alex
    Alex avatar
    4 posts
    Registered:
    31 Aug 2010
    21 Jul 2011
    Link to this post
    It wasn't an upgrade, it was built using 4.1 SP2. I fixed it by manually attaching the mdf and ldf and then updating the web.config

    This is a site that has been moved from the dev server to a testing server so I believe that is the proper procedure?

    Alex.
  14. Stanislav Velikov
    Stanislav Velikov avatar
    1113 posts
    Registered:
    30 Nov 2016
    25 Jul 2011
    Link to this post
    Hello Alex,

    Can you confirm you have permissions to read write and modify App_Data folder, because it seems Sitefinity can not access the folder. Also make sure you run the application in Full trust environment.

    Kind regards,
    Stanislav Velikov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  15. gregory hernandez
    gregory hernandez avatar
    59 posts
    Registered:
    10 Jul 2009
    02 Aug 2011
    Link to this post
    Hi Alex,

    I didn't upgrade to 4.1. I just installed it outright and I am getting the same issue.

    Would you please post a list of the "Groups" or "user names" and associated permissions that must be in place in order for Sitefinity to run?

    Thanks,
    Gregory Hernandez
  16. Stanislav Velikov
    Stanislav Velikov avatar
    1113 posts
    Registered:
    30 Nov 2016
    05 Aug 2011
    Link to this post
    Hi Gregory,

    If you are running Sitefinity locally on your development machine using the project manager or Visual Studio you just need to have read and write permissions on App_Data folder where Sitefinity.mdf is located.  When creating your project and selecting database don`t change the Instance which by default is SQLExpress.
    When using Sitefinity in IIS please refer to the documentation. You need to run your application pool with .NET v 4 and Application pool identity should be Network Service. Assign a new user network service to have full permissions on your website and you should have no problems. If you are using SQL Server there is one more step: create a new user for your database with login name [NT AUTHORITY\NETWORK SERVICE] and username NETWORK SERVICE and assign him to be db_owner on database and schema.




    Regards,
    Stanislav Velikov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  17. Craig
    Craig avatar
    82 posts
    Registered:
    07 Apr 2009
    06 Mar 2013
    Link to this post

    I ran into this issue as well.  I spent about a half a day on the issue following all of the advice that this thread was discussing.  I had no luck.

    It almost seemed like the account that was reading my .MDF file did not have the permissions to access it.

    Sure enough when I looked at the permissions for the .MDF file itself the Network Service account did not have access to read this file. I gave the Network Service account modify access to the .MDF file and its associated log file and then everything started working.

    BTW, the Network Service account is the account I used for my app pool.  I hope this helps anybody else who is having this issue.

     

    Craig

17 posts, 0 answered