November Happy Hour will be moved to Thursday December 5th.

Major exception after NuGet upgrade from version 7.8.2 to 9.10.2

Vote:
 

After making an upgrade of site with version 7.8.2 to version 9.10.2 I get an 500 error when the site starts up. After looking in the Event Viewer I find this quite lenghty error:

Exception information:
Exception type: TargetInvocationException
Exception message: Exception has been thrown by the target of an invocation.
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture)
at System.Web.HttpRuntime.CreateNonPublicInstance(Type type, Object[] args)
at System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context)
at System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext)

Initialize action failed for Initialize on class EPiServer.Shell.UI.InitializationModule, EPiServer.Shell.UI, Version=9.7.1.0, Culture=neutral, PublicKeyToken=8fe83dea738b45b7
at EPiServer.Framework.Initialization.InitializationEngine.InitializeModules()
at EPiServer.Framework.Initialization.InitializationEngine.ExecuteTransition(Boolean continueTransitions)
at EPiServer.Framework.Initialization.InitializationModule.EngineExecute(HostType hostType, Action`1 engineAction)
at EPiServer.Framework.Initialization.InitializationModule.FrameworkInitialization(HostType hostType)
at EPiServer.Global..ctor()
at Inwido.Web.General.Application.GlobalBase..ctor()
at Inwido.Web.Site.Outline.Global..ctor()
at ASP.global_asax..ctor() in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\db97f1d4\36c68e83\App_global.asax.0.cs:line 0

Error while building type System.Web.Profile.ProfileBase. See the inner exception for details
1.) new ProfileBase()
2.) System.Web.Profile.ProfileBase
3.) Instance of System.Web.Profile.ProfileBase
4.) new EPiServerProfile(*Default of ProfileBase*)
5.) EPiServer.Personalization.EPiServerProfile
6.) Instance of EPiServer.Notification.Internal.IQueryablePreference (EPiServer.Personalization.EPiServerProfile)
7.) new NotificationUserRepositoryImpl(*Default of IQueryableNotificationUsers*, Enumerable of EPiServer.Notification.INotificationProvider with all registered instances, Enumerable of EPiServer.Notification.Internal.IQueryablePreference with all registered instances)
8.) EPiServer.Notification.Internal.NotificationUserRepositoryImpl
9.) Instance of EPiServer.Notification.Internal.INotificationUserRepository (EPiServer.Notification.Internal.NotificationUserRepositoryImpl)
10.) new DefaultNotifier(*Default of INotificationUserRepository*, *Default of INotificationRepository*, Enumerable of EPiServer.Notification.INotificationFormatter with all registered instances, *Default of QueryableNotificationUserService*)
11.) EPiServer.Notification.Internal.DefaultNotifier
12.) Instance of EPiServer.Notification.INotifier (EPiServer.Notification.Internal.DefaultNotifier)
13.) new NotificationEventListener(*Default of INotifier*, *Default of PushMessenger*)
14.) EPiServer.Cms.Shell.UI.Notifications.NotificationEventListener
15.) Instance of EPiServer.Shell.UI.Internal.IEventListener (EPiServer.Cms.Shell.UI.Notifications.NotificationEventListener)
16.) Container.GetAllInstances(EPiServer.Shell.UI.Internal.IEventListener)

at lambda_method(Closure , IBuildSession , IContext )
at StructureMap.Building.BuildPlan.Build(IBuildSession session, IContext context) in c:\BuildAgent\work\a395dbde6b793293\src\StructureMap\Building\BuildPlan.cs:line 151
at StructureMap.Pipeline.LifecycleObjectCache.Get(Type pluginType, Instance instance, IBuildSession session) in c:\BuildAgent\work\a395dbde6b793293\src\StructureMap\Pipeline\LifecycleObjectCache.cs:line 71
at StructureMap.SessionCache.GetObject(Type pluginType, Instance instance, ILifecycle lifecycle) in c:\BuildAgent\work\a395dbde6b793293\src\StructureMap\SessionCache.cs:line 93
at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at StructureMap.Container.GetAllInstances(Type pluginType) in c:\BuildAgent\work\a395dbde6b793293\src\StructureMap\Container.cs:line 376
at EPiServer.ServiceLocation.StructureMapServiceLocator.d__4.MoveNext()
at EPiServer.ServiceLocation.ServiceLocatorImplBase.d__10`1.MoveNext()
at EPiServer.Shell.UI.InitializationModule.Initialize(InitializationEngine context)
at EPiServer.Framework.Initialization.Internal.ModuleNode.Execute(Action a, String key)
at EPiServer.Framework.Initialization.InitializationEngine.InitializeModules()

The connection name 'LocalSqlServer' was not found in the applications configuration or the connection string is empty. (C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config line 252)
at System.Web.Profile.ProfileBase.InitializeStatic()
at System.Web.Profile.ProfileBase..ctor()
at lambda_method(Closure , IBuildSession , IContext )

The connection name 'LocalSqlServer' was not found in the applications configuration or the connection string is empty.
at System.Web.Util.SecUtility.GetConnectionString(NameValueCollection config)
at System.Web.Profile.SqlProfileProvider.Initialize(String name, NameValueCollection config)
at System.Web.Configuration.ProvidersHelper.InstantiateProvider(ProviderSettings providerSettings, Type providerType)

When I check the database I see that the new tables for users, roles which after some version changed from aspnet_users => Users are not in the database. I have run the commandlet Update-EpiDatabase in Package Manager Console, so the database is updated (i hope!). So my thought about this is that due to the lack of these tables in the database I get this exception. The project for the site uses .Net framework 4.6.1. I also went from 7.8.2 directly to 9.10.2, is that a problem?

Someone who seen this before or maybe I should report it as a bug to Episerver?

I have found how to create these tables via the Package Manager Console with the following three steps:

  1. Enable-Migrations
  2. Add-Migration Init
  3. Update-Database

But when I run the first one I get the following error:

No context type was found in the assembly [my assembly name]

I can set the ContextTypeName or ContextAssemblyName as a parameter for the Enable-Migrations, but what is that for Episerver?

#173854
Edited, Jan 11, 2017 10:55
Vote:
 

Exception tells that there was an error creating new instance of profile manager object, that in turn was not able to find connection string named "LocalSqlServer".

Do you have <profile> element in web.config? What's the content? Do you use Episerver Aspnet identity or what is content of <membership> and <roleProvider> (name could be different) content in your web.config file?

#174363
Jan 25, 2017 8:22
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.