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

li9yvcax  于 2021-06-20  发布在  Kudu
关注(0)|答案(0)|浏览(250)

我被限制从我公司的网络(防火墙后面)连接到azure sql数据库。因此,如果我想使用entity framework core 1.0运行db迁移,我应该退出公司网络,或者在将应用程序部署到azure应用程序服务之后,向kudu发送rest api请求以调用命令。
基于wiki文档,https://github.com/projectkudu/kudu/wiki/rest-api#command,我成功地向kudu发送了一个rest api调用,以运行ef core数据库迁移命令,如下所示:

dnx ef database update -c MyDbContext -p MyEfModels

我能够在本地机器上运行相同的命令而没有任何问题(使用azuresqldb connectionstring,在防火墙之外)。但是,如果我在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.LazyRef1.get_Value() at Microsoft.Data.Entity.Commands.Program.Executor.<>c__DisplayClass5_0.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-final 以及 ASP.NET Core 1.0.0-rc1-update1 .

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题