error adding pages new mvc site

Craig Wyatt asked on December 8, 2020 22:08

I'm getting this error "An error occurred while attempting to retrieve page templates. Contact your system administrator and check that the page builder feature is registered correctly in the MVC project." in only one site of an installation that now has 2 sites. The previous site does not throw the error and seems to work fine.

In IIS both sites admin sites point to the same location for the cms. I found some threads that mentioned adding this builder.UseResourceSharingWithAdministration(); to the site so I did but it doesn't seem to make a difference.

Recent Answers


lawrence whittemore answered on December 8, 2020 22:09

Adding me to this so I can see if there is an answer.

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on December 9, 2020 06:54

The UseResourceSharingWithAdministration was deprecated with hotfix no.30 so it does nothing if you are using newer hotfix. Have you tried the other suggestions from this thread? Was it working fine before? If yes, what was changed?

0 votesVote for this answer Mark as a Correct answer

lawrence whittemore answered on December 9, 2020 15:13

So the answer there doesn't seem to work for me, my kentico package versions all match. this is what my controller looks like.

using System.Web.Mvc;

using CMS.DocumentEngine; using CMS.DocumentEngine.Types.NLHTV; using CMS.SiteProvider;

using Kentico.PageBuilder.Web.Mvc; using Kentico.Web.Mvc;

using NLHTV.Models;

namespace NLHTV.Controllers { public class HomeController : Controller { // GET: Home public ActionResult Redirect() { return View(); }

    [Route("Home")]        
    public ActionResult Index()
    {

        // Retrieves the Home page using the 'GetHome' method from the page type's generated provider
        Home homeNode = HomeProvider.GetHome("/Home", "en-us", SiteContext.CurrentSiteName)
                                    .Columns("DocumentName", "DocumentID", "HomeName", "HomeTitle", "HomeWelcome");

        // Returns a 404 error if retrieval is unsuccessful
        if (homeNode == null)
        {
            return HttpNotFound();
        }

        // Creates a new HomeViewModel instance based on the page data
        //Pulls from Models/Home/HomeViewModel.cs
        var homeModel = new HomeViewModel(homeNode);

        // Initializes the page builder with the DocumentID of the page            
        HttpContext.Kentico().PageBuilder().Initialize(homeNode.DocumentID);

        return View(homeModel);
    }
}

}

Not sure if this is anything, but in the view, the pagebuilder items all have green underlines.

0 votesVote for this answer Mark as a Correct answer

Craig Wyatt answered on December 9, 2020 19:03

this is the error I am getting when trying to view the page tab for the home page. Similar to what the guy mentioned in the question you shared.

Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.

Requested URL: /cmsctx/pv/administrator/culture/en-US/wg/b1ed5093-40e6-4e39-84d4-f25526465227/readonly/0/pts/637431624781131585/ea/1/h/5b9364e498659752ff1938db7d671c7ae54d1397ed414c81ad40e889b4b02593/-/home

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on December 10, 2020 06:20

When you install e.g. the sample Dancing Goat MVC project, do you see the same issue? I just want to test whether the issue is in the environment setup or somewhere within the MVC code. It would be much appreciated to know e.g. the steps how to reliably reproduce the issue on my side too. I have just the sample Dancing Goat, Medio Clinic or Learning Kit sites and codes.

0 votesVote for this answer Mark as a Correct answer

David te Kloese answered on December 10, 2020 09:29

Can you double check the Sites configuration for that new second site. Wrong preview url or not correctly registered web farms could be an issue...

0 votesVote for this answer Mark as a Correct answer

lawrence whittemore answered on December 10, 2020 14:48

(i'm the one who posted as craig, that account is our company account) Dancing Goat does work. When I install dancing goat, it makes it one site in IIS with two applications. I have mine set up with 2 separate sites, not sure if that might be part of it. There doesn't seem to be any major differences in the web configs for my site.

I'm only on my local machine so not using multiple web farms right now. The site did have 4 web farms listed with only 2 showing that they were working where dancing goat only had 2. So I removed the 2 that were not responding (it didn't make a difference)

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on December 10, 2020 15:05

So, what is the exact IIS setup?
What are the URLs?
What is set as the presentation URL?
Do the sites listen to each other?
What authentication method is used? E.g. is the anonymous authentication enabled?
What application pool settings are the sites using?
Are you using SSL?
What is set as the application pool identity and disk permissions?
What hotfix are you using? There were several bugs also fixed in the page builder.
I just did a separate site setup in my IIS and it is working fine. There must be something not set correctly in your environment or in the MVC app code. When you configure the sample Dancing Goat to use two sites - e.g. just adjust the home folders for your current sites, does it work?

0 votesVote for this answer Mark as a Correct answer

lawrence whittemore answered on December 10, 2020 15:32

here is the error in the error log if that helps Message: This preview URL has already expired. Please contact a responsible person to provide you with a valid preview URL.

Exception type: CMS.Helpers.InvalidVirtualContextException Stack trace: at CMS.Helpers.VirtualContext.LoadVirtualContextValues(String& relativePath) at Kentico.Content.Web.Mvc.VirtualContextUrlRewriter.ProcessVirtualContextRequest(HttpContextBase httpContextWrapper)

0 votesVote for this answer Mark as a Correct answer

lawrence whittemore answered on December 10, 2020 15:45

So, what is the exact IIS setup? 2 sites, one points to the cms folder, and the other points to the mvc folder, both sites use same app pool,

What are the URLs? these are only set up locally (host file just points to local ip. http://nlhtvadmin.northernlighthealth.org/ http://nlhtv.northernlighthealth.org/

What is set as the presentation URL? http://nlhtv.northernlighthealth.org/

Do the sites listen to each other? not sure what this means

What authentication method is used? E.g. is the anonymous authentication enabled? mvc has anonymous admin has anonymous and forms

What application pool settings are the sites using? both use the same app pool, ApplicationPoolIdenitity Are you using SSL? no What is set as the application pool identity and disk permissions? ApplicationPoolIdenitity, app pool is set to allow on all except special permissions

What hotfix are you using? There were several bugs also fixed in the page builder. 52 for mine dancing goat is 29, I'll upgrade dancing goat to 52 to see if it makes a difference. We have a live sites on a web farm that I'll move my stuff out to when it is ready so I didn't want to upgrade past 52 because of the hassle of upgrading the web farm version. (the live site we have also has the same issue, was just never a problem)

I just did a separate site setup in my IIS and it is working fine. There must be something not set correctly in your environment or in the MVC app code. When you configure the sample Dancing Goat to use two sites - e.g. just adjust the home folders for your current sites, does it work? I'll check and get back to you

0 votesVote for this answer Mark as a Correct answer

lawrence whittemore answered on December 14, 2020 18:48

I've separated the dancing goat sites in IIS by creating 2 new sites the same way I had with my site and the dancing goat site seems to be fine with no errors in the page view.

0 votesVote for this answer Mark as a Correct answer

David te Kloese answered on December 14, 2020 21:20 (last edited on December 14, 2020 21:21)

Wild guess:

So although it's the 2nd site could it be that the HomeProvider.GetHome() method does only gets published pages?

So you create the page and create a node (location in tree), but the document (content/language) version is obviously not yet published.. Meaning your code does return a node (!) but documentID is null/0... and you pass that into your pagebuilder initialisation! Can you check that while debugging? If so get to the actual call for getting the nodes and check (based on current state) if you also get not yet published docs.

0 votesVote for this answer Mark as a Correct answer

lawrence whittemore answered on December 14, 2020 21:34

The first site has the error too, I had not noticed until I had done more testing. I wonder if this is related. In the view, the @Html.Kentico().EditableArea("editableArea") line has a green underline and says something to the fact of "Assuming assembly reference System.wem.mvc..... you may need to supply a runtime policy"

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on December 15, 2020 07:38

This seems to be an issue with the DotNetCompilerPlatform as mentioned here.

0 votesVote for this answer Mark as a Correct answer

lawrence whittemore answered on December 16, 2020 19:32

I've given up and started with a clean install of kentico with the blank MVC site. This seems to work, so there is a difference between starting a site based off the default site kentico sets up (not dancing goat, but the blank mvc project when installing a new site from the KIM tool) vs when you create a new mvc project in visual studio.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.