在添加迁移期间Code First中的错误 [英] Errors in Code First during add-migration

查看:59
本文介绍了在添加迁移期间Code First中的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的添加迁移在添加迁移期间常规失败但不一致。迁移总是进入脚手架步骤,然后大约4次中有5次我们将收到如下内容:

Our add-migrations are failing routinely but not consistently during add-migration. The migration always gets to the scaffolding step and then roughly 4 out of 5 times we will receive something like the following:

System.Runtime.Remoting.RemotingException:Object'/ 2355037d_df43_460b_8737_725c0c1c80be / hvdculybngjc_rcnskixmk7 + _2.rem'已断开连接或在服务器上不存在。

    at EnvDTE.Project.get_Properties()

    at System.Data.Entity.Migrations.Extensions.ProjectExtensions.GetPropertyValue [T](Project project,String propertyName)

    at System.Data.Entity.Migrations.Extensions.ProjectExtensions.AddFile(Project project,String path,String contents)

    at System.Data.Entity.Migrations.Utilities.MigrationWriter.Write(ScaffoldedMigration scaffoldedMigration,Boolean rescaffolding,Boolean force,String name)

    at System.Data.Entity.Migrations.AddMigrationCommand。<> c__DisplayClass3。< .ctor> b__1()

    at System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command)
$
对象'/2355037d_df43_460b_8737_725c0c1c80be/hvdculybngjc_rcnskixmk7+_2.rem'已断开连接或在服务器上不存在。 />

System.Runtime.Remoting.RemotingException: Object '/2355037d_df43_460b_8737_725c0c1c80be/hvdculybngjc_rcnskixmk7+_2.rem' has been disconnected or does not exist at the server.
   at EnvDTE.Project.get_Properties()
   at System.Data.Entity.Migrations.Extensions.ProjectExtensions.GetPropertyValue[T](Project project, String propertyName)
   at System.Data.Entity.Migrations.Extensions.ProjectExtensions.AddFile(Project project, String path, String contents)
   at System.Data.Entity.Migrations.Utilities.MigrationWriter.Write(ScaffoldedMigration scaffoldedMigration, Boolean rescaffolding, Boolean force, String name)
   at System.Data.Entity.Migrations.AddMigrationCommand.<>c__DisplayClass3.<.ctor>b__1()
   at System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command)
Object '/2355037d_df43_460b_8737_725c0c1c80be/hvdculybngjc_rcnskixmk7+_2.rem' has been disconnected or does not exist at the server.

有时候迁移类会被生成,但更多时候它不会生成。对这个错误的搜索表明,垃圾收集的内容不应该是垃圾,但这并不能帮助我们解决这个问题。

Sometimes the migration class gets generated anyway but more often it does not. Searches on this error have indicated that something is being garbage collected that isn't supposed to be but that doesn't really help us work around the issue.

我们的数据迁移项目在。 NET 4.5,EF 5在Windows 8,Visual Studio 2012和SQL Server 2012中工作。

Our data migration project is in .NET 4.5 with EF 5 working in Windows 8, Visual Studio 2012 and SQL Server 2012.

我们将非常感谢您提出的任何建议或信息。

Any suggestions or information you may have will be greatly appreciated.

谢谢

推荐答案

嗨Dane,

是RemotingException:对象已断开连接或在服务器上通常不存在,如果对象已被GC控制。

Yes the RemotingException: Object has been disconnected or does not exist at the server usually occurred if the object has been GC'ed.

我搜索了一段时间但是在使用时没有发现类似的问题;添加的迁移。你在开发哪种项目? WinForms,MVC还是别的什么?

I searched a while but didn't find similar issues when using add-migrations. Which kind of project are you developing? WinForms, MVC or something else?

这是一个关于RemotingException的线程。虽然它不是使用添加迁移生成的,但您可以查看是否在类似方案中断开了对象。

Here is a thread talking about RemotingException. Although it is not generated using add-migrations, you may have a look whether you have disconnect the object in similar scenarios.

http://stackoverflow.com/questions/6339469/object-has-been-disconnected-or-不存在服务器异常

祝你好运,


这篇关于在添加迁移期间Code First中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆