Sitecore / ASP.NET-Core-SDK

The official open source ASP.NET Core SDK for Sitecore DXP and XM Cloud.
https://sitecore.github.io/ASP.NET-Core-SDK/
Apache License 2.0
9 stars 5 forks source link

Multisite / Single site is not working with XM cloud .net SDK (Always looking for dafault site name property) #23

Open Nelsjnjr123 opened 3 hours ago

Nelsjnjr123 commented 3 hours ago

What happened?

Description

I have tried to enable the XM cloud multisite by following the readme file provided in the repo, I have provided the "EdgeContextId" and "EditingSecret", but I'm not able to see the multisite based on the domain name I have configured in Sitecore, I have deployed this rendering host to Azure web app, and I have configured the same domain names in the Sitecore, but still multisite not working

Reproduction Steps 1. Open Clone the XM cloud repo for asp.net SDK and update the "EdgeContextId" and "EditingSecret" without providing the default site name, Configure 2 sites in XM cloud and update the domain names for the 2 sites, now deploy the rendering host to Azure web app and browse the domain

2. Execute

Once the web app is deployed to Azure, now browse the configured domain in the Sitecore

Actual Behavior

It throws an error, and the site is not resolving, this is because the code is expecting the Default site name to be added in the appsettings, but if we provide the default site name, then the site works but not as multisite, it only loads the site which we configured as default site in the appsetting.

In Local development, I tried to load multisite with DEV tunnels. Still, it is resolving as localhost in the code, so I hope the domain will not be resolved for the multisite scenario in Local, but it is even not working when deployed to Azure.

In Local development, even in a single site scenario the code always looks for the default site name property to be filled in appsettings.

Expected Behavior

The correct site should be resolved based on the domain name URL(for sitea and siteb) without setting the default site name.

Reference: Sitecore domain name

appsetting without default sitename

Site name missing

Relevant log output

No response

Code of Conduct

sc-ivanlieckens commented 2 hours ago

@Nelsjnjr123 thank you for your report. Could I ask your middleware configuration? Did you add UseMultisite() to your Application Builder?

Nelsjnjr123 commented 2 hours ago

Thank you, I have used in program.cs , Please find the below screenshot.

usemultisite