EF Code First Migration throws StackOverflowException on Azure Web Role

The problem occurs when you perform the first migrations of EF 6.1.2 code in the Azure Web Role (WS 2012 R2). The same migrations are performed normally locally, even if I specify the connection string to the Sql database (Azure).

The StackOverflowException is thrown by the Entity Framework code, and the first line of ANY of my migrations doesn't even get there.

I tried to migrate in three 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 a StackOverflowException in Visual Studio when the remote debugging of a web role is removed. The error is logged in the Windows event log of the web role (log information at the bottom of this message).

I have two migrations. I tried to run the first from PMC and the second from a web role, but no luck.

I tried installing .Net 4.5.2 on the server by resizing the virtual machine from XS to S and downgrading EF to version 6.1.1. Nothing succeeded. In addition, I tried downloading the "E: \ sites \ 0" folder from the web role to my local computer, installing the application in IIS and connecting my VS debugger, and this does not exclude this exception. There should be something different between my Windows 8.1 and Windows Server 2012 R2.

I spent a lot of time on different things, but I do not want to give up on this and perform my migrations from the 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: Invalid application name: w3wp.exe, version: 8.5.9600.16384, timestamp: 0x5215df96 Fault module name: clr.dll, version: 4.0.30319.34014, timestamp: 0x52e0b86c Exception code: 0xc00000fd Error offset: 0x00000000001954 : 0xc60 Application start time: 0x01d02d4d77fdfb93 Error application path: d: \ windows \ system32 \ inetsrv \ w3wp.exe Failure module path: D: \ Windows \ Microsoft.NET \ Framework64 \ v4.0.30319 \ clr.dll Report Id: f5e4d6dc -9940-11e4-80bd-0003ff508f5b Passport full name: Error accessing the batch application identifier: Xml event:
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 D64 \ Windows. 0.30319 \ clr.dll f5e4d6dc-9940-11e4-80bd-0003ff508f5b

Simple steps to reproduce this error:

+6
source share
2 answers

This is identified as a bug in updating Microsoft Visual Studio 2013 Update 4. As a temporary work, disable "Lazy Initialization" in the settings of IntelliTrace β†’ IntelliTrace Events. We are investigating the fix for this error in a future update for Visual Studio 2013.

+2
source

The responsibility for the StackOverflowException exception was IntelliTrace. I don't know the cause of the problem between IntelliTrace and First First Migrations that cause this behavior, but when I load IntelliTrace logs, I could see many Sql exceptions:

IntelliTrace Summary 2/18/15

I have already lost a lot of time, so I will not explore it further. The easiest workaround for me now is to simply disable IntelliTrace before deploying my roles on the Internet.

Disable IntelliTrace

If anyone is interested, here are the IntelliTrace logs .

I hope this helps someone solve this problem without losing as much time as I did.

+1
source

Source: https://habr.com/ru/post/980830/


All Articles