Sitecore Headless Development

Sitecore ASP.NET Rendering with docker is already very well documented in Sitecore Official site. While working with some of the clients I realized, not everyone work with docker and some are still interested how things works without Docker and this encouraged me share little about how this works without docker . 

First I would recommend to read sitecore official document for overall understanding about Sitecore Headless Development  https://doc.sitecore.com/developers/100/developer-tools/en/walkthrough--using-the-getting-started-template.html

To keep it simple I divided into few steps 

Step 1 
Install Sitecore 10 on your local machine.

Step 2 
or alternatively skip step 2 and download from here  which does not include Docker files but everything else is same . 

Install the template (You need this because you will create solutions based on this template.)
dotnet new -i Sitecore.DevEx.Templates --nuget-source https://sitecore.myget.org/F/sc-packages/api/v3/index.json

dotnet new sitecore.aspnet.gettingstarted -n MyProject

sitecore.aspnet.gettingstarted will have all docker file included . You can ignore this . Open the solution in Visual studio . This is how project structure looks like . Since we are not using docker , few of the files need to be changed manually .

In appsettings.json , Change InstanceUri to your already installed Sitecore 10 host name

In Platform – Asp.net Include – Site.config , change the host name and ServerSideRenderingEngineEndPointUrl to RenderingSC10 or any name which you want to give to your rendering host website . Step 3 have detail explanation how you will create this in IIS

Step 3

Create a empty website and give same name as given for ServerSideRenderingEngineEndPointUrl in site.config. Make sure you to change in AppPool setting . It should be “No Managed code” in .net CLR version

Step 4

On root directory of your project : Open PowerShell and execute following

Don’t forget to Replace your local instance name

  1. PowerShell : – dotnet sitecore login –cm https://YoursSitecore10HostName/ –auth https://YoursSitecore10LocalidentityserverHostName/ –allow-write true

this will open sitecore Admin page . Enter your admin credentials and approve for Application access

2. PowerShell :- dotnet sitecore ser push

This will push content / Template / Layout / Rendering to sitecore, which come as part of sitecore.aspnet.gettingstarted project creation

Make sure to Install Sitecore Command Line Interface or else you might see this error

Make sure the GraphQL service is installed and available

Follow official guideline to “install Sitecore Command Line Interface”

https://doc.sitecore.com/developers/100/developer-tools/en/install-sitecore-command-line-interface.html

Step 5

Go to visual studio ,right click on Rendering host and Publish to the newly created Asp.net Rendering host website .

Make sure to copy or publish site.config and other 2 configs in your sitecore10 installation App_Config\Include folder .

Step 6

Open your new created Asp.net Rendering host website in browser . If you are trying to debug your code , make sure you changed to “Managed code” in attach to option

Also Verify Sitecore CM for new created Contents and Layout .

Leave a comment