KUDU的实体框架核心1.0数据库迁移

时间:2016-04-21 12:58:35

标签: azure entity-framework-core kudu

我被限制从我公司的网络(防火墙后面)连接到Azure SQL数据库。因此,如果我想使用Entity Framework Core 1.0运行数据库迁移,我应该离开公司网络或向KUDU发送REST API请求,以便在将应用程序部署到Azure App Service后调用命令。

根据wiki文档https://github.com/projectkudu/kudu/wiki/REST-API#command,我设法向KUDU发送REST API调用以运行EF Core数据库迁移命令,如:

dnx ef database update -c MyDbContext -p MyEfModels

我能够从本地计算机上运行相同的命令而没有任何问题(使用防火墙外的Azure SQL DB连接字符串)。但是,如果我在KUDU运行相同的命令,它会抱怨:

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.<>c__DisplayClass4_1.<.ctor>b__2() at Microsoft.Data.Entity.Internal.LazyRef`1.get_Value() at Microsoft.Data.Entity.Commands.Program.Executor.<>c__DisplayClass5_0.<ListContexts>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.

即使我也无法运行以下命令:

dnx ef dbcontext list

似乎有些程序集缺少加载,但我不确定如何调试它以从LoaderExceptions ReflectionTypeLoadException属性中获取更多详细信息。有人可以帮帮我吗?

我正在使用Entity Framework 7.0.0-rc1-finalASP.NET Core 1.0.0-rc1-update1

0 个答案:

没有答案