Sitecore 8: Hostname not being retrieved for the website definition. What could be wrong?

Recently I have been working on a Sitecore project and I was building a list of sites dynamically like this:

sites = SiteManager.GetSites().Select(s => new SiteInfo(s.Properties)).ToList();

The problem is that at debug mode I could see the values of the hostname attributes for the website definition properly set. But it would not populate the property with the value from the config. in other words the value would return blank for the hostname attribute.

I checked the showconfig page and got the following definition:

<site name="website" enableTracking="true" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content/brands/clientname" startItem="/home" database="web" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="50MB" registryCacheSize="0" viewStateCacheSize="0" xslCacheSize="25MB" filteredItemsCacheSize="10MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false" cacheRenderingParameters="true" renderingParametersCacheSize="10MB" language="en" patch:source="Client.Brands.ClientName.Project.ClientName.config" itemwebapi.mode="Off" itemwebapi.access="ReadOnly" itemwebapi.allowanonymousaccess="false" enableItemLanguageFallback="false" enableFieldLanguageFallback="false" hostname="clientname.dev.local|local.clientname.com"/>

As pointed out here (thanks @MarasM) I needed to change the hostname to use the capital N as in hostName because the site attributes are case sensitive. Changing it made it to start working so I decided to post this to help out anyone who faces this issue.

You can read more about site attributes here.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s