Whenever I launch the Visual Studio 2015 Publish Web Dialogue (or Visual Studio 2013, both have the same issue) for a specific project, it takes ~20-30 seconds for it t
TL;DR: As a workaround for this problem, find your DbContext
class which inherit from IdentityDbContext<>
and change base class constructor from base("DefaultConnection")
to base("DefaultConnection", false)
and do a full rebuild on your solution. That will disable checking against Entity 1.0.0 which causes timeouts when run from Publish Web.
The results of debugging: After much debugging, we found the root cause.
DbContext
class, locating it with reflection and calling it inside VisualStudio's process.ConnectionManager
will use devenv.exe.config
instead of your web.config
, hence your web.config
with its connection strings is ignored.IdentityDbContext<>
in the form of base("DefaultConnection")
, it will call base("DefaultConnection", true)
, which (according to the second parameter) will try to detect whether your database uses Identity 1.0.0 schema.IdentityDbContext<>
(usually it will be "DefaultConnection"
)web.config
is not loaded, the connection string with such name would be unavailable.For unavailable connection string, Entity would call DefaultConnectionFactory
. Again, you can't customize it, as web.config
is not loaded. By default, DefaultConnectionFactory
will try to connect to .\SQLEXPRESS
with Initial Catalog
= your connection name, likely resulting in the following connection string:
Data Source=.\SQLEXPRESS;Initial Catalog=DefaultConnection;Integrated Security=True;MultipleActiveResultSets=True
If you do not have SQL Express installed, that will result in SQL exception, which will retry futile attempts to connect until timeout expires.
So, the culprit is Publish Web, which incorrectly runs assembly through reflection without loading the corresponding web.config
.
Debugging recipe we have started with: Let's figure what's happening inside.
Context Menu on Visual Studio's process | Create Dump | Create Minidump...
STACK_TEXT
in analysis results)Update
Now that OSR's analyze failed to analyze the stacks in dumps, it seems we'll have to do it the hard way.
One-time preparation
Debugging Tools For Windows
as part of Windows SDK (clear all other checkboxes to not install what you don't need)WinDBG (X86)
from installed packageIn File | Symbol File Path...
write
srv*C:\Symbols*http://msdl.microsoft.com/download/symbols
Press File | Save workspace
Analyzing a dump
File | Open crash dump...
and open your dump.!analyze -v
and press Enter.