Cannot Create New Pages After Installing Service Pack

Tim Lemke asked on June 27, 2019 14:44

Hello,

After installing the Kentico 12SP yesterday I can no longer create any new pages. It appears the issue has to do with new page templates. Here is the error the CMS site is giving me.

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.

Why is the CMS trying to retrieve page templates when I have not created any?

Does anyone know how I can resolve this issue? I had no issues creating new pages prior to the service pack.

Nothing shows up in the event log.

Thanks, Tim

Correct Answer

Stephen Diamond answered on July 2, 2019 15:30

Support helped us fix this issue.

During project initialization we had to make a call to builder.UseResourceSharingWithAdministration(); in the Registerfeatures mathod of ApplicationCongfig.

1 votesVote for this answer Unmark Correct answer

Recent Answers


Brenden Kehren answered on June 27, 2019 18:08

Did you rebuild your project after you applied the hotfix?

Also did you check the server/computer event logs?

0 votesVote for this answer Mark as a Correct answer

Tim Lemke answered on June 27, 2019 18:33

Hi Brenden,

Yes I rebuilt my project after applying the hotfix.

I did check and there was nothing in the Kentico event log nor the server event logs.

Any idea what the issue might be?

Thanks, Tim

0 votesVote for this answer Mark as a Correct answer

Trevor Fayas answered on June 28, 2019 01:16

Are you getting a Error reading JObject from JsonReader 500 error on yours?

Server Error in '/' Application.
Error reading JObject from JsonReader. Path '', line 0, position 0.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: Newtonsoft.Json.JsonReaderException: Error reading JObject from JsonReader. Path '', line 0, position 0.

Source Error: 


Line 2:  @using Kentico.Web.Mvc
Line 3:  <div>
Line 4:      @Html.Kentico().WidgetZone()
Line 5:  </div>

Source File: C:\Web\Kentico Boilerplate\Boilerplate\Views\Shared\Sections\_DefaultSection.cshtml    Line: 4 

If you view the frame of the page itself and check your network tab of Chrome's inspector, that's what i'm getting.

0 votesVote for this answer Mark as a Correct answer

Tim Lemke answered on June 28, 2019 15:24

Hi Trevor,

No I am not getting that 500 error.

I am getting these two errors in the console though:

GetResource.ashx?scriptfile=~%2fCMSScripts%2fjquery%2fjquery-core.js:14 OPTIONS http://cfpc.78beta.com/cmsctx/pv/administrator/culture/en-CA/wg/56702023-715a-4704-9db1-aa0f7f736c1a/readonly/0/h/3685ab85949a173530dd74d4327667bb2cdfbb1c25b2abedc9b5168d1bfff29f/-/Kentico.PageBuilder/PageTemplates/GetFiltered?uh=50f9f4d276498e3ed51b3fc23db72ee242ff17057b204fdfbdcca0e0e7f46cc1&pagetype=CFPC.TemplateTwelve&culture=en-CA 405 (Method Not Allowed)

Access to XMLHttpRequest at 'http://cfpc.78beta.com/cmsctx/pv/administrator/culture/en-CA/wg/56702023-715a-4704-9db1-aa0f7f736c1a/readonly/0/h/3685ab85949a173530dd74d4327667bb2cdfbb1c25b2abedc9b5168d1bfff29f/-/Kentico.PageBuilder/PageTemplates/GetFiltered?uh=50f9f4d276498e3ed51b3fc23db72ee242ff17057b204fdfbdcca0e0e7f46cc1&pagetype=CFPC.TemplateTwelve&culture=en-CA' from origin 'http://cfpc-cms.78beta.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Please not that the name of the page type I am trying to create is "TemplateTwelve" and is not related in any way to the newly released page template feature.

Does anyone have any idea what is going on? I would really like to resolve this issue quickly as it has put a halt on content entry on the site we are working on and we are working with a tight deadline.

Thanks, Tim

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on June 28, 2019 15:34

Tim,

It looks like a domain/url issue based on your error. Looks like a page/script file is trying to be served up from this domain: http://cfpc-cms.78beta.com and your actual site is being served up on this domain: http://cfpc.78beta.com. Do you have a hard coded URL somewhere or have you done a hard clearing of your cache in your browser?

0 votesVote for this answer Mark as a Correct answer

Tim Lemke answered on June 28, 2019 15:49

Hi Brendan,

I have confirmed that there are no hard coded URL's and have hard cleared the cache of my browser numerous times.

Regards, Tim

0 votesVote for this answer Mark as a Correct answer

Trevor Fayas answered on June 28, 2019 17:12

I saw that error at some point as well, and right now i'm working with support on an error with adding new pages (that the page templates in MVC isn't working right).

There may be some bugs with the SP that they are resolving : /

0 votesVote for this answer Mark as a Correct answer

Tim Lemke answered on June 28, 2019 17:34

Hi Trevor,

Okay good to know. We too are working with support now on our end. Hopefully this issue is resolved soon.

Please let me know if you arrive at any solutions / fixes.

Thanks, Tim

0 votesVote for this answer Mark as a Correct answer

Trevor Fayas answered on June 28, 2019 18:14

I think we've found the issue. You are correct on the error, it's a CORS policy issue. and Brian is correct that it's because of the differnet domains. Kentico Admin is trying to get a list of Page Templates from the MVC Site (where they are defined) and if the domains are differnet, the request is denied and it blows up.

If you have both on localhost it works fine. I Just verified.

0 votesVote for this answer Mark as a Correct answer

Stephen Diamond answered on June 28, 2019 19:40

I'm getting this same error in our current development environment since applying the service pack. We are running both on localhost, my CMS is running on port 51872 and the MVC site running on 58180.

The error received in the Chrome console

`Access to XMLHttpRequest at 'http://localhost:58180/cmsctx/pv/administrator/culture/en-US/wg/299e4883-dba1-4092-acb3-27fdac0be4f9/readonly/0/h/2e23c6eea499993c46d13fc247783c453b496a029214ab48b4eca81d800a529d/-/Kentico.PageBuilder/PageTemplates/GetFiltered?uh=9606755860087a86a279950d4bfe2fafe57263db27a450d90bb1eca6a01fd5dd&pagetype=ContentPage&culture=en-US' 
from origin 'http://localhost:51872' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.`
0 votesVote for this answer Mark as a Correct answer

Trevor Fayas answered on June 28, 2019 20:35

"It is only considered to be the same if the protocol, host and port is the same: Same Origin Policy"

https://stackoverflow.com/questions/19966707/cors-error-on-same-domain

So the port variation will cause the same issue. You will need to do sibling virtual directories, both on the same port, ex

localhost/AdminPanel
localhost/Site
0 votesVote for this answer Mark as a Correct answer

Trevor Fayas answered on July 2, 2019 17:44

That is the solution for the CORS issue (so you can mark it as answered), you need to add that builder.UseResourceSharingWithAdministration();

They need to update the documentation as this is only mentioned for EMS features with newsletters.

1 votesVote for this answer Mark as a Correct answer

Tim Lemke answered on July 3, 2019 15:13

Yes using:

builder.UseResourceSharingWithAdministration();

fixed the issue we were facing.

Thank you everyone for your help!

Regards,

Tim

1 votesVote for this answer Mark as a Correct answer

John Jones answered on July 5, 2019 04:17

I still seem to be getting this but its not because of the CORS, I seem to be getting a 401 unauthorized message when getting to the page template selection page. ( /CMSModules/Content/CMSDesk/MVC/TemplateSelection.aspx )

0 votesVote for this answer Mark as a Correct answer

Sean Wright answered on July 14, 2019 02:09 (last edited on July 14, 2019 02:09)

If you have builder.UseResourceSharingWithAdministration(); in your MVC startup and you are still seeing the issue with Error reading JObject from JsonReader. Path '', line 0, position 0., make sure that the updates in the newest versions of the Kentico.AspNet.Mvc NuGet package are applied to your MVC project.

Specifically, ensure that the \Kentico folder in the NuGet package matches the \Kentico folder in your MVC project, and also apply any XML transformations in the web.config.

If you are using <PackageReference> for NuGet packages then you will need to manually apply these changes as the Kentico NuGet packages are not built for <PackageReference>.

0 votesVote for this answer Mark as a Correct answer

Andy Bochmann answered on July 27, 2019 02:36

I still got the CORS error with an application hosted on Azure. I had to go into the CORS settings of the Azure App Service to get it to work.

0 votesVote for this answer Mark as a Correct answer

Richard Shackleton answered on September 17, 2019 14:30

Seeing this error on a site we've upgraded and we're seeing a different CORS error:

Access to XMLHttpRequest at 'https://domain.local/cmsctx/pv/admin/culture/en-GB/wg/14a05b99-128d-4d4f-a7cf-68e7b49f2610/readonly/0/h/d9e0b36c8257bd5f6b6225d7141165c572818d0732d96b17cf4454edf86dc30c/-/Kentico.PageBuilder/PageTemplates/GetFiltered?uh=f9c418c523bdeed38ae108dece4b02321731c4ffb97a93f2e116f0214449af0a&pagetype=FF.SectorPage&culture=en-GB' from origin 'https://localhost' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: The 'Access-Control-Allow-Origin' header contains multiple values 'https://localhost, *', but only one is allowed.

0 votesVote for this answer Mark as a Correct answer

Arjan van Hugten answered on October 1, 2019 17:00 (last edited on October 1, 2019 17:01)

Hi Richard,

I had the same issue on a site. This was caused by having Access-Control-Allow-Origin set in the web.config. With hotfix 12.0.30 this is already set by Kentico and this caused having multiple Access-Control-Allow-Origin headers.

You can only have one see: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS/Errors/CORSMultipleAllowOriginNotAllowed. So you should validate not setting the header on another place.

0 votesVote for this answer Mark as a Correct answer

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