We have an ASP.NET project using IIS Express while debugging. After starting VS2013, then loading the solution, building the solution and starting the web application in debug mode, the output window lists a bunch of DLLs that get loaded and unloaded. After a bit of searching, I discovered that IIS Express rebuilds the site for each request. Here is a small part of the output window:
'iisexpress.exe' (CLR v4.0.30319: /LM/W3SVC/2/ROOT-14-130719418943209850): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Web.Entity\v4.0_4.0.0.0__b77a5c561934e089\System.Web.Entity.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'iisexpress.exe' (CLR v4.0.30319: /LM/W3SVC/2/ROOT-14-130719418943209850): Loaded 'C:\Users\ca0ssnc\AppData\Local\Temp\Temporary ASP.NET Files\vs\f3da8155\99ebd29d\App_Web_dqpvaqg5.dll'.
'iisexpress.exe' (CLR v4.0.30319: /LM/W3SVC/2/ROOT-14-130719418943209850): Loaded 'C:\Users\ca0ssnc\AppData\Local\Temp\Temporary ASP.NET Files\vs\f3da8155\99ebd29d\App_Web_global.aspx.cdcab7d2.bocgg9o6.dll'.
'iisexpress.exe' (CLR v4.0.30319: /LM/W3SVC/2/ROOT-14-130719418943209850): Loaded 'C:\Users\ca0ssnc\AppData\Local\Temp\Temporary ASP.NET Files\vs\f3da8155\99ebd29d\App_Web_global.aspx.cdcab7d2.kvvdlbnf.dll'.
'iisexpress.exe' (CLR v4.0.30319: Domain 15): Unloaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'
'iisexpress.exe' (CLR v4.0.30319: /LM/W3SVC/2/ROOT-14-130719418943209850): Unloaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_32\System.Web\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Web.dll'
'iisexpress.exe' (CLR v4.0.30319: /LM/W3SVC/2/ROOT-14-130719418943209850): Unloaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll'
'iisexpress.exe' (CLR v4.0.30319: /LM/W3SVC/2/ROOT-14-130719418943209850): Unloaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll'
See the line where it says Domain 15? That's because the pool restarted 15 times!
Also, an important fact is that the solution sources and output binaries are all stored in a mapped drive. The drive resides on our network.
Now I have tried everything I could find on the net:
- Removing all breakpoints in the project
- Loading symbols in a local cache directory (in Tools->Options->Debugging->Symbols)
- and a few other solutions that did not work
After a bit of reading on the internet, I found that it may have to do with a file that gets changed when the application starts, and IIS Express must recompile the application to get the changes into effect. But that's the thing, no file gets changed when starting the application.
After more reading, I found that when the application binaries reside on a network drive, the time stamp of the files may change when starting the application, which causes IIS Express to recompile the application, even though the contents of the files did not change. So I tried to find a solution for this problem, and a few people said to disconnect the development computer from the network, wait a few seconds and reconnect the network! Yeah, right...
I was out of solutions, so I tried this far fetched solution. Lo and behold! It worked!!! No more application restarts! The output window now looks like this:
'iisexpress.exe' (CLR v4.0.30319: /LM/W3SVC/2/ROOT-1-130719436820489369): Loaded 'C:\Users\ca0ssnc\AppData\Local\Temp\Temporary ASP.NET Files\vs\f3da8155\99ebd29d\App_Web_erxb23tr.dll'.
'iisexpress.exe' (CLR v4.0.30319: /LM/W3SVC/2/ROOT-1-130719436820489369): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Web.Mobile\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Web.Mobile.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'iisexpress.exe' (CLR v4.0.30319: /LM/W3SVC/2/ROOT-1-130719436820489369): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Web.RegularExpressions\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Web.RegularExpressions.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'iisexpress.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Web.RegularExpressions\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Web.RegularExpressions.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'iisexpress.exe' (CLR v4.0.30319: /LM/W3SVC/2/ROOT-1-130719436820489369): Loaded 'C:\Users\ca0ssnc\AppData\Local\Temp\Temporary ASP.NET Files\vs\f3da8155\99ebd29d\assembly\dl3\a0da26c9\85d61bc1_9668d001\CalculsWrapper.dll'. Symbols loaded.
'iisexpress.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\Users\ca0ssnc\AppData\Local\Temp\Temporary ASP.NET Files\vs\f3da8155\99ebd29d\assembly\dl3\a0da26c9\85d61bc1_9668d001\CalculsWrapper.DLL'. Symbols loaded.
'iisexpress.exe' (CLR v4.0.30319: /LM/W3SVC/2/ROOT-1-130719436820489369): Loaded 'C:\Users\ca0ssnc\AppData\Local\Temp\Temporary ASP.NET Files\vs\f3da8155\99ebd29d\assembly\dl3\95fa9a38\65cf12c4_9668d001\HardLockWrapper.dll'. Symbols loaded.
'iisexpress.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\Users\ca0ssnc\AppData\Local\Temp\Temporary ASP.NET Files\vs\f3da8155\99ebd29d\assembly\dl3\95fa9a38\65cf12c4_9668d001\HardLockWrapper.DLL'. Symbols loaded.
'iisexpress.exe' (CLR v4.0.30319: /LM/W3SVC/2/ROOT-1-130719436820489369): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Drawing\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'iisexpress.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Drawing\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'iisexpress.exe' (CLR v4.0.30319: /LM/W3SVC/2/ROOT-1-130719436820489369): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Web.Services\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Web.Services.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
No more DLLs that gets unloaded. The application does not get restarted anymore (see that DefaultDomain is always used). Now the problem is that this issue reappears every time I restart VS2013. Each time I restart VS2013, I have to disconnect and reconnect my network connection.
Also, another important fact: I use Web Essentials for Visual Studio 2013 Update 4. When I disable this extension, no more problem! The application does not gets restarted and I do not need to disconnect my network. So the problem is probably coming from this extension.
Now can someone please tell me what in the world is the relationship between me disconnecting my network connection, Web Essentials, and the time stamps of the web application files being changed for whatever the reason??
Application_Start
again, so you can debug it from start. If this does't happen during real IIS usage without debugging, then it should be fine. Network connection can be used by VS to load symbols for debugged assemblies – Hiddenite