Staging website does not pull through related pages

Richard Lloyd asked on April 4, 2019 10:44

This is a strange issue which I haven't been able to find an answer to on DevNet or online. On our Test Instance we have page types that have sections where you select other pages (which we are calling 'related recipe' or 'related brand' etc. On Test in the view we just loop through these and the links display correctly. In Staging however the same code shows nothing and we get a zero count from the collection. The strange thing is that when I copy down the Staging database and test on my laptop the view displays correctly. When I create a new database on the Staging server and use the same build as on my laptop (which is the same as Test) and then link the existing IIS instance to that you would think it would work but it does not. Same thing with zero count in the collection. I have tried refreshing the IIS instance and this has made no difference. I am now at a loss to know what to do next. Is this a Kentico issue or an IIS issue? If so what should I do next? Thanks for your help.

Recent Answers


Roman Hutnyk answered on April 4, 2019 11:52

Can you capture SQL queries staging environment produces and test them in SQL management studio? or simply use profiler on staging? I mean it would be nice to get understanding of the stage you loosing data at

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on April 4, 2019 11:57

What code are you using? Are you checking the IDs or what is the variable? In staging the IDs in general could be different.

0 votesVote for this answer Mark as a Correct answer

Richard Lloyd answered on April 4, 2019 12:40 (last edited on April 4, 2019 12:43)

Correction: This is the code: Recipe currentPage = SiteHelper.StandardDocumentQuery<Recipe>(Request.Path, 1, PathTypeEnum.Explicit).First();

I also ran a SQL trace on Staging but it returns zero rows on the server but rows are returned on the laptop.

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on April 4, 2019 12:42 (last edited on April 4, 2019 13:33)

Could you please send a bit more code? From one line it is hard to tell. Also the piece you shared looks like something custom. I would recommend running the code in debug mode to see what is going on.
What is the code of the SiteHelper.StandardDocumentQuery method?

1 votesVote for this answer Mark as a Correct answer

Richard Lloyd answered on April 5, 2019 11:24

The underlying helper method for the SiteHelper.StandardDocumentQuery is this: public static List<T> StandardDocumentQuery<T>(string path = "/", int nestingLevel = 1, PathTypeEnum pathTypeEnum = PathTypeEnum.Children) where T : TreeNode, new() { return DocumentHelper.GetDocuments<T>() .OnCurrentSite() .Published() .Path(path, pathTypeEnum) .NestingLevel(nestingLevel) .OrderBy("NodeOrder") .CombineWithDefaultCulture().ToList(); } I don't know if that is helpful. I've been trying to get some more information using the SQl Server profiler but its not proving very fruitful. I write to the event log right after the call and it returns zero as a count in the trace.

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on April 5, 2019 11:28

I am sorry but without having the big picture of the code it is really hard to tell. I would recommend comparing the DB tables - CMS_Relationship, CMS_RelationshipName on your local and target instances. I would say that the IDs do not match and you need to adjust your code to take the GUID into account or follow this documentation.

0 votesVote for this answer Mark as a Correct answer

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