EF code首先迁移抛出StackOverflowException Azure上的Web角色 [英] EF Code First Migration throws StackOverflowException on Azure Web Role
问题描述
在Azure的Web角色(WS 2012 R2)执行EF 6.1.2 code首先迁移时出现的问题。同样的迁移罚款在本地运行,即使我点连接字符串(天青)的SQL数据库。
该StackOverflowException是由实体框架code扔了,我的任何迁移的第一行doesn't甚至被打到。
我曾尝试三种不同的方式运行迁移:
DbMigrator迁移=新DbMigrator(配置);
migrator.Update(); //这里抛出异常
第二:
DbMigrator迁移=新DbMigrator(配置);
。pendingMigrations = migrator.GetPendingMigrations()了ToList();
的foreach(在pendingMigrations串pendingMigration)
{
migrator.Update(pendingMigration); //这里抛出异常
}
和使用的web.config:
<&上下文GT;
<上下文类型=Superb.WorkNextDoor.EFRepository.Context.WndDbContext,Superb.WorkNextDoor.EFRepository,版本= 1.0.0.0,文化=中性>
< databaseInitializer type=\"System.Data.Entity.MigrateDatabaseToLatestVersion`2[[Superb.WorkNextDoor.EFRepository.Context.WndDbContext, Superb.WorkNextDoor.EFRepository],[Superb.WorkNextDoor.EFRepository.Migrations.Migrations.WndDbMigrationsConfiguration,Superb.WorkNextDoor.EFRepository.Migrations],的EntityFramework>
< / databaseInitializer>
< /背景>
< /背景>
我看到在Visual Studio中StackOverflowException时I'm远程调试Web角色。错误被记录在Web角色(在这个岗位的底部日志信息)的Windows事件日志。
我有两个迁移。我试图从运行PMC第一个从Web角色第二次,但没有运气。
我曾尝试在服务器上安装的.Net 4.5.2,改变从XS虚拟机大小S与EF降级到6.1.1版本。毫无效果。另外,我想该文件夹下载:从网络中的作用E \\网站\\ 0到我的本地计算机上,安装的应用程序在IIS和连接我的VS调试器,它不会抛出该异常。这里一定是我的Windows 8.1之间和不同的东西的Windows Server 2012 R2。
我花了很多时间尝试不同的东西,但我不希望放弃就这个问题和必须从包管理器控制台执行我的迁移。
日志名称:应用程序来源:应用程序错误日期:结果
2015年1月11日上午03时21分42秒事件ID:1000年任务类别:(100)级别:结果
错误关键字:经典用户:N / A计算机:结果
RD0003FF508F5B说明:错误的应用程序名:w3wp.exe,
版本:8.5.9600.16384,时间戳:0x5215df96错误模块名称:
clr.dll,版本:4.0.30319.34014,时间戳:0x52e0b86c异常
code:0xc00000fd故障偏移:0x0000000000195499出错进程ID:
0xc60错误应用程序启动时间:0x01d02d4d77fdfb93断裂作用
应用程序路径:D:\\ WINDOWS \\ SYSTEM32 \\ INETSRV \\ w3wp.exe的错误模块
路径:D:\\ WINDOWS \\ Microsoft.NET \\ Framework64 \\ v4.0.30319 \\ clr.dll报告
ID:f5e4d6dc-9940-11e4-80bd-0003ff508f5b断裂作用包全名:
断层包相关的应用ID:事件XML:结果
1000
2
100
0x80000000000000
467
应用
RD0003FF508F5B
程序w3wp.exe
8.5.9600.16384
5215df96
clr.dll
4.0.30319.34014
52e0b86c
C00000FD
0000000000195499
C60
01d02d4d77fdfb93
D:\\ WINDOWS \\ SYSTEM32 \\ INETSRV \\程序w3wp.exe
D:\\ WINDOWS \\ Microsoft.NET \\ Framework64 \\ v4.0.30319 \\ clr.dll
f5e4d6dc-9940-11e4-80bd-0003ff508f5b
块引用>简单的步骤重现此错误:
- 下载此示例项目:<一href=\"http://www.asp.net/mvc/overview/getting-started/getting-started-with-ef-using-mvc/migrations-and-deployment-with-the-entity-framework-in-an-asp-net-mvc-application\">http://www.asp.net/mvc/overview/getting-started/getting-started-with-ef-using-mvc/migrations-and-deployment-with-the-entity-framework-in-an-asp-net-mvc-application
- 添加到CloudServiceProject解决方案,并添加Web项目作为Web角色
- 发布它天青
- 浏览网站,并转到学生卡(此访问数据库,初始化尝试执行迁移)。
- 偏偏是一样的。
解决方案这被确定为在Microsoft Visual Studio 2013更新4中的错误作为一个临时的变通禁用懒惰初始化的IntelliTrace设置下 - >的IntelliTrace事件。我们正在研究在为Visual Studio 2013以后的更新修复这个bug。
The issue occurs when executing EF 6.1.2 code first migrations in an Azure Web Role (WS 2012 R2). The same migrations run fine locally, even if I point the connection string to the (Azure) Sql Database.
The StackOverflowException is thrown by Entity Framework code, and the first line of ANY of my migrations doesn´t even get hit.
I have tried running the migrations in three different ways:
DbMigrator migrator = new DbMigrator(configuration); migrator.Update(); // Here the exception is thrown
second:
DbMigrator migrator = new DbMigrator(configuration); pendingMigrations = migrator.GetPendingMigrations().ToList(); foreach (string pendingMigration in pendingMigrations) { migrator.Update(pendingMigration); // Here the exception is thrown }
and using web.config:
<contexts> <context type="Superb.WorkNextDoor.EFRepository.Context.WndDbContext, Superb.WorkNextDoor.EFRepository, Version=1.0.0.0, Culture=neutral"> <databaseInitializer type="System.Data.Entity.MigrateDatabaseToLatestVersion`2[[Superb.WorkNextDoor.EFRepository.Context.WndDbContext, Superb.WorkNextDoor.EFRepository], [Superb.WorkNextDoor.EFRepository.Migrations.Migrations.WndDbMigrationsConfiguration, Superb.WorkNextDoor.EFRepository.Migrations]], EntityFramework"> </databaseInitializer> </context> </contexts>
I see the StackOverflowException in Visual Studio when I´m remote debugging the web role. An error is recorded in windows event log of the web role (log info at the bottom of this post).
I have two migrations. I have tried running the first one from PMC and the second from the web role but no luck.
I have tried installing .Net 4.5.2 on the server, changing the VM size from XS to S and downgrading EF to version 6.1.1. Nothing worked. Also, I tried downloading the folder "E:\sites\0" from the web role to my local computer, installed the app on IIS and attached my VS Debugger and it doesn't throw that exception. There has got to be something different between my Windows 8.1 and that Windows Server 2012 R2.
I have spent a lot of time trying different things but I don´t want to give up on this and have to execute my migrations from package manager console.
Log Name: Application Source: Application Error Date:
1/11/2015 3:21:42 AM Event ID: 1000 Task Category: (100) Level:
Error Keywords: Classic User: N/A Computer:
RD0003FF508F5B Description: Faulting application name: w3wp.exe, version: 8.5.9600.16384, time stamp: 0x5215df96 Faulting module name: clr.dll, version: 4.0.30319.34014, time stamp: 0x52e0b86c Exception code: 0xc00000fd Fault offset: 0x0000000000195499 Faulting process id: 0xc60 Faulting application start time: 0x01d02d4d77fdfb93 Faulting application path: d:\windows\system32\inetsrv\w3wp.exe Faulting module path: D:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll Report Id: f5e4d6dc-9940-11e4-80bd-0003ff508f5b Faulting package full name: Faulting package-relative application ID: Event Xml:
1000 2 100 0x80000000000000 467 Application RD0003FF508F5B w3wp.exe 8.5.9600.16384 5215df96 clr.dll 4.0.30319.34014 52e0b86c c00000fd 0000000000195499 c60 01d02d4d77fdfb93 d:\windows\system32\inetsrv\w3wp.exe D:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll f5e4d6dc-9940-11e4-80bd-0003ff508f5bEasy steps to reproduce this error:
- Download this sample project: http://www.asp.net/mvc/overview/getting-started/getting-started-with-ef-using-mvc/migrations-and-deployment-with-the-entity-framework-in-an-asp-net-mvc-application
- Add a CloudServiceProject to the solution and add the web project as a web role
- Publish it to azure
- Browse the web site and go to students tab (this hits the database and the initializer tries to execute the migrations).
- Happens the same.
解决方案This is identified as a bug in Microsoft Visual Studio 2013 Update 4. As a temporary work around disable "Lazy Initialization" under IntelliTrace Settings -> IntelliTrace Events. We are investigating fixing this bug in a future update for Visual Studio 2013.
这篇关于EF code首先迁移抛出StackOverflowException Azure上的Web角色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!