1

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

根据 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

似乎缺少一些程序集来加载,但我不确定如何调试它以LoaderExceptionsReflectionTypeLoadException. 任何人都可以帮助我吗?

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

4

0 回答 0