Website channel with ID 0 does not exist
My site runs fine locally, however once deployed to azure, I get the error "Website channel with ID 0 does not exist" at points where I am trying to get the webSiteChannelContext. The site loads fine in the CMS, I can edit the pages without problem. However, on the live site I get an error page due to the above issue with the site context.
What could cause this?
Environment
Xperience by Kentico version: [30.3.1]
.NET version: [8]
Execution environment: [azure)]
Link to relevant Xperience by Kentico documentation
Answers
The website channel domain needed to be changed from localhost to the azure url
It's also worth noting that code executing within the administration UI outside of the Page Builder is not associated with a website, even if you access the administration UI through the same domain as one of your website channels.
Within the admin UI (outside of the Page Builder) the website channel context ID will be 0.
To answer this question, you have to login first.