Search code examples
asp.netsqlcontent-management-systemumbracoumbraco6

Object reference not set to an instance of an object GetDomains call on startup


*Note : This is not a null reference duplicate question. It was not so apparent what was causing it and needed deeper investigation.

My site was working fine on my local dev box and then I decided to convert Umbraco 6 from using a embedded database (SDF) to full SQL database (MDF). The database conversion went well using WebMatrix but now after changing the web config to use full SQL the site gets the below error when I run it. I have read through a few help articles online for this but nothing seems to solve my issue. Any ideas? (SQL rights, cache maybe, did I miss a config setting?

I did this basically http://carlosmartinezt.com/2014/03/umbraco-migrate-from-sql-ce-to-sql-server/

Here is my web.config

    <system.data>
    <DbProviderFactories>
      <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data" />
    </DbProviderFactories>
  </system.data>
  <system.net>
    <mailSettings>
      <smtp>
        <network host="127.0.0.1" userName="username" password="password" />
      </smtp>
    </mailSettings>
  </system.net>
  <connectionStrings>
    <add connectionString="Data Source=KBURMARK;Initial Catalog=Umbraco;Integrated Security=True" name="Umbraco" providerName="System.Data.SqlClient" />
    <!-- Important: If you're upgrading Umbraco, do not clear the connection string / provider name during your web.config merge. -->
  </connectionStrings>

Here is the error I am getting

[NullReferenceException: Object reference not set to an instance of an object.]
   umbraco.cms.businesslogic.web.Domain.<GetDomains>b__0() +122
   Umbraco.Core.Cache.<>c__DisplayClass1`1.<GetCacheItem>b__0() +41
   Umbraco.Core.Cache.HttpRuntimeCacheProvider.GetCacheItem(String cacheKey, Func`1 getCacheItem, Nullable`1 timeout, Boolean isSliding, CacheItemPriority priority, CacheItemRemovedCallback removedCallback, CacheDependency dependency) +246
   Umbraco.Core.Cache.HttpRuntimeCacheProvider.GetCacheItem(String cacheKey, Func`1 getCacheItem, Nullable`1 timeout, Boolean isSliding, CacheItemPriority priority, CacheItemRemovedCallback removedCallback, String[] dependentFiles) +159
   Umbraco.Core.Cache.CacheProviderExtensions.GetCacheItem(IRuntimeCacheProvider provider, String cacheKey, Func`1 getCacheItem, Nullable`1 timeout, Boolean isSliding, CacheItemPriority priority, CacheItemRemovedCallback removedCallback, String[] dependentFiles) +219
   Umbraco.Core.CacheHelper.GetCacheItem(String cacheKey, TimeSpan timeout, Func`1 getCacheItem) +339
   umbraco.cms.businesslogic.web.Domain.GetDomains(Boolean includeWildcards) +243
   Umbraco.Web.Routing.DomainHelper.GetAllDomains(Boolean includeWildcards) +40
   Umbraco.Web.Routing.PublishedContentRequestEngine.FindDomain() +365
   Umbraco.Web.Routing.PublishedContentRequestEngine.PrepareRequest() +59
   Umbraco.Web.Routing.PublishedContentRequest.Prepare() +36
   Umbraco.Web.UmbracoModule.ProcessRequest(HttpContextBase httpContext) +738
   Umbraco.Web.UmbracoModule.<Init>b__7(Object sender, EventArgs e) +132
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +136
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69

Solution

  • I solved this issue the same way. Set the connection string name="umbracoDbDSN"