I saw this error. It drove me nuts, but I finally figured it out. My problem had nothing to do with web.config
, assemblers, Initialize_42
or Initialize(false)
hacks or something else.
Here where I made a mistake ...
I turned on the automatic application of such migrations:
App_Start:
Database.SetInitializer( new MigrateDatabaseToLatestVersion<DataContext, Migrations.Configuration>() );
Migration / Configuration.cs:
internal sealed class Configuration : DbMigrationsConfiguration<Path.To.DataContext> { public Configuration() { AutomaticMigrationsEnabled = true; } }
And this is called through WebActivator as follows:
[assembly: WebActivator.PreApplicationStartMethod( typeof(service_tracker_mvc.App_Start.DatabaseInitializer), "Start")]
I accidentally discovered that disabling this process led to the work of the profiler. The problem with how this happens is that this initialization process is too early. This usually happens during Application_Start
(unless you use this fancy WebActivator stuff), so I changed it to PostStart
. Now it works:
▼▼▼▼ [assembly: WebActivator.PostApplicationStartMethod( typeof(service_tracker_mvc.App_Start.DatabaseInitializer), "Start")]
Michael haren
source share