The HostIdentifier value is missing or empty exception when activating Azure database cache

Topics: Troubleshooting
Nov 19, 2013 at 8:43 PM
Edited Nov 19, 2013 at 8:44 PM
Hello everybody !

I wanted to try the Windows Azure caching modules on my Orchard installation by activating these modules. But, when I tried to activate the Database caching module, I got an exception on my installation and I now, I can"t do anything on my Orchard website, ever through command line.

Here is the exception :
[Exception: The HostIdentifier value is missing or empty.]
Orchard.Azure.Services.Caching.Database.AzureCacheProvider.Start(IDictionary2 properties) +235

[Exception: The Orchard.Azure.DatabaseCache configuration settings are missing or invalid.]
Orchard.Azure.Services.Caching.Database.AzureCacheProvider.Start(IDictionary
2 properties) +388
NHibernate.Impl.SessionFactoryImpl..ctor(Configuration cfg, IMapping mapping, Settings settings, EventListeners listeners) +954
NHibernate.Cfg.Configuration.BuildSessionFactory() +227
Orchard.Data.SessionFactoryHolder.GetSessionFactory() in d:\Builds\OrchardFull\src\Orchard\Data\SessionFactoryHolder.cs:69
Orchard.Data.SessionLocator.Demand() in d:\Builds\OrchardFull\src\Orchard\Data\SessionLocator.cs:40
Orchard.Data.SessionLocator.For(Type entityType) in d:\Builds\OrchardFull\src\Orchard\Data\SessionLocator.cs:36
Orchard.ContentManagement.DefaultContentQuery.BindSession() in d:\Builds\OrchardFull\src\Orchard\ContentManagement\DefaultContentQuery.cs:31
Orchard.ContentManagement.DefaultContentQuery.BindItemVersionCriteria() in d:\Builds\OrchardFull\src\Orchard\ContentManagement\DefaultContentQuery.cs:53
Orchard.ContentManagement.ContentQuery1.Orchard.ContentManagement.IContentQuery<T>.ForType(String[] contentTypes) in d:\Builds\OrchardFull\src\Orchard\ContentManagement\DefaultContentQuery.cs:197
Orchard.Core.Settings.Services.SiteService.<GetSiteSettings>b__0(AcquireContext
1 ctx) in d:\Builds\OrchardFull\src\Orchard.Web\Core\Settings\Services\SiteService.cs:30
Orchard.Caching.Cache2.CreateEntry(TKey k, Func2 acquire) in d:\Builds\OrchardFull\src\Orchard\Caching\Cache.cs:57
Orchard.Caching.Cache2.AddEntry(TKey k, Func2 acquire) in d:\Builds\OrchardFull\src\Orchard\Caching\Cache.cs:27
System.Collections.Concurrent.ConcurrentDictionary2.AddOrUpdate(TKey key, Func2 addValueFactory, Func3 updateValueFactory) +162
Orchard.Caching.Cache
2.Get(TKey key, Func2 acquire) in d:\Builds\OrchardFull\src\Orchard\Caching\Cache.cs:17
Orchard.Core.Settings.Services.SiteService.GetSiteSettings() in d:\Builds\OrchardFull\src\Orchard.Web\Core\Settings\Services\SiteService.cs:29
Orchard.Settings.CurrentSiteWorkContext.Get(String name) in d:\Builds\OrchardFull\src\Orchard\Settings\CurrentSiteWorkContext.cs:13
System.Linq.WhereSelectArrayIterator
2.MoveNext() +82
System.Linq.Enumerable.FirstOrDefault(IEnumerable1 source, Func2 predicate) +215
Orchard.Environment.WorkContextImplementation.FindResolverForState(String name) in d:\Builds\OrchardFull\src\Orchard\Environment\WorkContextImplementation.cs:32
System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd(TKey key, Func2 valueFactory) +83
Orchard.Environment.WorkContextImplementation.GetState(String name) in d:\Builds\OrchardFull\src\Orchard\Environment\WorkContextImplementation.cs:28
Orchard.Localization.Services.SiteCultureSelector.GetCulture(HttpContextBase context) in d:\Builds\OrchardFull\src\Orchard\Localization\Services\SiteCultureSelector.cs:13
System.Linq.WhereSelectArrayIterator2.MoveNext() +82
System.Linq.WhereEnumerableIterator
1.MoveNext() +196
System.Linq.Buffer1..ctor(IEnumerable1 source) +520
System.Linq.<GetEnumerator>d__0.MoveNext() +145
System.Linq.Enumerable.Any(IEnumerable1 source) +109
Orchard.Localization.Services.DefaultCultureManager.GetCurrentCulture(HttpContextBase requestContext) in d:\Builds\OrchardFull\src\Orchard\Localization\Services\DefaultCultureManager.cs:64
Orchard.Localization.Services.CurrentCultureWorkContext.<Get>b__0(WorkContext ctx) in d:\Builds\OrchardFull\src\Orchard\Localization\Services\CurrentCultureWorkContext.cs:13
Orchard.Environment.<>c__DisplayClass7
1.<FindResolverForState>b__5() in d:\Builds\OrchardFull\src\Orchard\Environment\WorkContextImplementation.cs:37
Orchard.Environment.WorkContextImplementation.GetState(String name) in d:\Builds\OrchardFull\src\Orchard\Environment\WorkContextImplementation.cs:28
Orchard.Localization.Text.Get(String textHint, Object[] args) in d:\Builds\OrchardFull\src\Orchard\Localization\Text.cs:28
Orchard.UI.Admin.AdminFilter.OnAuthorization(AuthorizationContext filterContext) in d:\Builds\OrchardFull\src\Orchard\UI\Admin\AdminFilter.cs:23
System.Web.Mvc.ControllerActionInvoker.InvokeAuthorizationFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor) +156
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +854992
System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__19() +40
System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +15
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +65
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +15
System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +51
System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult) +42
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +15
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +51
Orchard.Mvc.Routes.HttpAsyncHandler.EndProcessRequest(IAsyncResult result) in d:\Builds\OrchardFull\src\Orchard\Mvc\Routes\ShellRoute.cs:159
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +606
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +288
This exception is also displayed in command line, so I can't disable the module. I had also try to restart the website in IIS and now, I don't enver have any exception, but a get an HTTP 404 error instead.

Is there anything to do to at least save my installation and settings, or, even better, to get the Azure caching working ?

Thank you very much =) !
Jan 30, 2014 at 5:56 PM
I know this is old, but I'll respond for others that may encounter this problem.

Before enabling Azure caching, or at least before you can use the application after enabling Azure caching, you need to follow the Configure Cache Cluster section of the configuration docs. Remember, if you don't specifically name your cache on Azure, leave the cache name blank in the configuration file.