title: Entity Framework Core 1.0 Database Migration at KUDU
body: <p>I am restricted to connect to Azure SQL Database from my company's network (behind a firewall). Therefore, if I want to run DB migration using Entity Framework Core 1.0, I should be out of the corporate network or send a REST API request to KUDU to invoke a command after deploying an application to Azure App Service.</p>
  
  <p>Based on the wiki document, <a href="https://github.com/projectkudu/kudu/wiki/REST-API#command" rel="nofollow">https://github.com/projectkudu/kudu/wiki/REST-API#command</a>, I managed to send a REST API call to KUDU to run EF Core database migration command like:</p>
  
  <pre><code>dnx ef database update -c MyDbContext -p MyEfModels
  </code></pre>
  
  <p>I was able to run the same command from my local machine without any issue (using the Azure SQL DB connectionstring, outside the firewall). However, if I run the same command at KUDU it complains:</p>
  
  <p><code>System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
    at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
    at System.Reflection.RuntimeAssembly.get_DefinedTypes()
    at Microsoft.Data.Entity.Design.Internal.StartupInvoker..ctor(String startupAssemblyName, String environment)
    at Microsoft.Data.Entity.Design.DbContextOperations..ctor(ILoggerProvider loggerProvider, String assemblyName, String startupAssemblyName, String environment)
    at Microsoft.Data.Entity.Commands.Program.Executor.&lt;&gt;c__DisplayClass4_1.&lt;.ctor&gt;b__2()
    at Microsoft.Data.Entity.Internal.LazyRef`1.get_Value()
    at Microsoft.Data.Entity.Commands.Program.Executor.&lt;&gt;c__DisplayClass5_0.&lt;ListContexts&gt;b__0()
    at Microsoft.Data.Entity.Commands.Program.Executor.Execute(Action action)
  Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
  </code></p>
  
  <p>Even I can't run the following command either:</p>
  
  <pre><code>dnx ef dbcontext list
  </code></pre>
  
  <p>It seems that some assemblies are missing to load but I'm not sure how I can debug it to get more details from the <code>LoaderExceptions</code> property of <code>ReflectionTypeLoadException</code>. Can anyone help me out, please?</p>
  
  <p>I'm using <code>Entity Framework 7.0.0-rc1-final</code> and <code>ASP.NET Core 1.0.0-rc1-update1</code>.</p>