问题
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??
回答1:
Make sure you're running the solution from a local drive.
I experienced the same issue. Every request was really slow, even just returning a code 200 result, or loading the favicon.
The output window showed similar symptoms to that described by the OP.
I was running my solution from a mapped drive (even though the map was pointing to a local drive).
Running it from the local drive directly cured the problem. Thanks to the comment from @Simon Senécal on the other answer which pointed me in the right direction.
来源:https://stackoverflow.com/questions/29304720/iis-express-loads-and-unloads-modules-for-each-request