0

I'm running up.ps1 in step 7 of Create the MyProject solution in the Sitecore 10 Getting Started Template. While id.myproject.localhost and cm.myproject.localhost work fine for me, but myproject.localhost throw a exception caused by pageTile is null. pageTile is null

  • This is docker logs myproject_rendering_1
C:\Users\Admin>docker logs myproject_rendering_1
dotnet watch ⌚ Polling file watcher is enabled
dotnet watch ⌚ Did not find a HotReloadProfile or running a non-default command. Watching with legacy behavior.
dotnet watch ⌚ Evaluating dotnet-watch file set.
dotnet watch ⌚ Running MSBuild target 'GenerateWatchList' on 'C:\solution\src\.\rendering\RenderingHost.csproj'
dotnet watch 🚀 Started 'C:\Program Files\dotnet\dotnet.exe' '' with process id 1280
dotnet watch ⌚ Process id 1280 ran for 1876ms
dotnet watch ⌚ Watching 58 file(s) for changes
dotnet watch ⌚ Watch command can be configured to use --no-restore.
dotnet watch ⌚ No restore arguments: run --no-restore --no-launch-profile
dotnet watch ⌚ Configuring the app to use browser-refresh middleware.
dotnet watch ⌚ Refresh server running at ws://localhost:49176.
dotnet watch 🚀 Started 'C:\Program Files\dotnet\dotnet.exe' '' with process id 1764
dotnet watch ⌚ Running dotnet with the following arguments: run --no-launch-profile
dotnet watch 🚀 Started
warn: Microsoft.AspNetCore.DataProtection.Repositories.FileSystemXmlRepository[60]
      Storing keys in a directory 'C:\Users\ContainerAdministrator\AppData\Local\ASP.NET\DataProtection-Keys' that may not be persisted outside of the container. Protected data will be unavailable when container is destroyed.
info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[63]
      User profile is available. Using 'C:\Users\ContainerAdministrator\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest.
info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[58]
      Creating key {98eeb537-6260-4066-9190-7187ee38a5a1} with creation date 2022-08-05 04:10:05Z, activation date 2022-08-05 04:10:05Z, and expiration date 2022-11-03 04:10:05Z.
info: Microsoft.AspNetCore.DataProtection.Repositories.FileSystemXmlRepository[39]
      Writing data to file 'C:\Users\ContainerAdministrator\AppData\Local\ASP.NET\DataProtection-Keys\key-98eeb537-6260-4066-9190-7187ee38a5a1.xml'.
info: Microsoft.Hosting.Lifetime[14]
      Now listening on: http://[::]:80
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
      Content root path: C:\solution\src\rendering
info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
      Request starting HTTP/1.1 GET http://www.myproject.localhost/ - -
dbug: Sitecore.LayoutService.Client.RequestHandlers.HttpLayoutRequestHandler[0]
      Layout Service Http Request Message : Method: GET, RequestUri: 'http://cm/sitecore/api/layout/render/jss?sc_apikey={dba6453f-6a71-4de9-b9c3-36ea77fcc730}&sc_site=MyProject&item=%2F&sc_lang=en', Version: 1.1, Content: <null>, Headers:
      {
        User-Agent: Mozilla/5.0
        User-Agent: (Windows NT 10.0; Win64; x64)
        User-Agent: AppleWebKit/537.36
        User-Agent: (KHTML, like Gecko)
        User-Agent: Chrome/103.0.0.0
        User-Agent: Safari/537.36
        X-Forwarded-Proto: http
        X-Forwarded-For: ::ffff:172.22.202.43
      }
info: System.Net.Http.HttpClient.jss-endpoint.LogicalHandler[100]
      Start processing HTTP request GET http://cm/sitecore/api/layout/render/jss?sc_apikey={dba6453f-6a71-4de9-b9c3-36ea77fcc730}&sc_site=MyProject&item=%2F&sc_lang=en
info: System.Net.Http.HttpClient.jss-endpoint.ClientHandler[100]
      Sending HTTP request GET http://cm/sitecore/api/layout/render/jss?sc_apikey={dba6453f-6a71-4de9-b9c3-36ea77fcc730}&sc_site=MyProject&item=%2F&sc_lang=en
info: System.Net.Http.HttpClient.jss-endpoint.ClientHandler[101]
      Received HTTP response headers after 2282.6771ms - 403
info: System.Net.Http.HttpClient.jss-endpoint.LogicalHandler[101]
      End processing HTTP request after 2308.5253ms - 403
dbug: Sitecore.LayoutService.Client.RequestHandlers.HttpLayoutRequestHandler[0]
      Layout Service Http Response : StatusCode: 403, ReasonPhrase: 'Sitecore.LayoutService module requires SXA or JSS license.', Version: 1.1, Content: System.Net.Http.HttpConnectionResponseContent, Headers:
      {
        Cache-Control: no-cache, no-store
        Pragma: no-cache
        Server: Microsoft-IIS/10.0
        X-Frame-Options: SAMEORIGIN
        Set-Cookie: myproject#lang=en; path=/; secure; SameSite=None
        Set-Cookie: ASP.NET_SessionId=gme42feptr4tyesjkmgquic0; path=/; secure; HttpOnly; SameSite=None
        Set-Cookie: SC_ANALYTICS_GLOBAL_COOKIE=6ff6735330eb469f815cc6d1545a6f43|False; expires=Mon, 02-Aug-2032 04:22:20 GMT; path=/; secure; HttpOnly; SameSite=None
        X-XSS-Protection: 1; mode=block
        X-Content-Type-Options: nosniff
        Content-Security-Policy: default-src 'self' 'unsafe-inline' 'unsafe-eval' https://apps.sitecore.net; img-src 'self' data:; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self' 'unsafe-inline' https://fonts.gstatic.com; block-all-mixed-content;
        Date: Fri, 05 Aug 2022 04:22:21 GMT
        Expires: -1
        Content-Length: 0
      }
info: Microsoft.AspNetCore.Routing.EndpointMiddleware[0]
      Executing endpoint 'MyProject.Controllers.SitecoreController.Index (MyProject)'
info: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[3]
      Route matched with {action = "Index", controller = "Sitecore"}. Executing controller action with signature Microsoft.AspNetCore.Mvc.IActionResult Index(Sitecore.LayoutService.Client.Response.Model.Field`1[System.String]) on controller MyProject.Controllers.SitecoreController (MyProject).
warn: Sitecore.AspNet.RenderingEngine.Binding.SitecoreLayoutModelBinder[0]

Failed to bind pageTitle to Field`1 type.
Binding Source : RouteField.
info: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[2]
      Executed action MyProject.Controllers.SitecoreController.Index (MyProject) in 210.0314ms
info: Microsoft.AspNetCore.Routing.EndpointMiddleware[1]
      Executed endpoint 'MyProject.Controllers.SitecoreController.Index (MyProject)'
fail: Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[1]
      An unhandled exception has occurred while executing the request.
      System.NullReferenceException: Object reference not set to an instance of an object.
         at MyProject.Controllers.SitecoreController.Index(Field`1 pageTitle) in C:\solution\src\rendering\Controllers\SitecoreController.cs:line 11
         at lambda_method2(Closure , Object , Object[] )
         at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()
         at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()
      --- End of stack trace from previous location ---
         at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
      --- End of stack trace from previous location ---
         at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
      --- End of stack trace from previous location ---
         at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
         at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
         at Sitecore.AspNet.RenderingEngine.Middleware.RenderingEngineMiddleware.Invoke(HttpContext httpContext, IViewComponentHelper viewComponentHelper, IHtmlHelper htmlHelper)
         at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context)
         at Sitecore.AspNet.ExperienceEditor.ExperienceEditorMiddleware.Invoke(HttpContext httpContext)
         at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
      Request finished HTTP/1.1 GET http://www.myproject.localhost/ - - - 500 - text/html;+charset=utf-8 3518.4161ms
info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
      Request starting HTTP/1.1 GET http://www.myproject.localhost/_framework/aspnetcore-browser-refresh.js - -
info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
      Request finished HTTP/1.1 GET http://www.myproject.localhost/_framework/aspnetcore-browser-refresh.js - - - 200 11944 application/javascript;+charset=utf-8 3.1165ms

Do you know what problems? How can I solve it?

3

1 Answer 1

0

You need to publish the website for seeing your changes on the cd instance. If you will see the Test the MyProject solution section on the same URL - https://doc.sitecore.com/xp/en/developers/100/developer-tools/walkthrough--using-the-getting-started-template.html#test-the-myproject-solution it is pointing to publish the website page - https://doc.sitecore.com/xp/en/developers/100/developer-tools/publish,-run,-and-test-the-getting-started-template-projects.html

To publish the Platform project:

  1. in Content Editor, on the Publish tab, below the Publish icon, click the black arrow (Illustration showing the black arrow on the Publish icon.) and click Publish site.
  2. In the Publish Site window, select Smart publish and click Publish.

The RenderingHost project uses dotnet watch which automatically compiles and deploys all changes to the myproject_rendering_1 container. You can visit the rendering host page at https://www.myproject.localhost/, and you can see the rendering host log by clicking the container in Docker Dashboard or by running this PowerShell command from the MyProject folder:

docker-compose logs -f rendering

5
  • I've tried publishing but the isue still there which shows from logs is "Failed to bind pageTitle to Field`1 type.". Do you know the pageTitle value come to SitecoreController->public IActionResult Index([SitecoreRouteField] Field<string> pageTitle)? Aug 5 at 8:17
  • More information, I'm using Visual Studio to publish the website, I wonder why we need to publish from The Content Editor while this is the first time I run Sitecore, I don't even know The Content Editor before. Aug 5 at 8:37
  • it is Sitecore published as myproject.localhost and is using a web database, please try it from content editor Aug 5 at 8:40
  • I have published from Content Editor but the exception still there. I don't change any things in Content Editor, only publishing. Aug 5 at 9:48
  • This is video how I published, does it have any mistake? youtu.be/gNtHNwECsXE Aug 5 at 10:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.