简体   繁体   中英

ASP.NET Debug hangs after Rebuild

I have an odd problem - when running a debug session on my MVC 5 app, the app never loads in the browser. The system endlessly cycles through an error in VS, before any code is executed. It seems to hang during the IIS express initialization (loading its libraries). Here's what I know so far:

Behavior:

  • Upon initial launch of VS 2015, app runs fine.
  • After changing a line or two of code - javascript, C#, doesn't matter, anything that triggers a re-build - it no longer will launch in the debugger. Even changing back to undo your code change, does not recover.
  • Recovery is possible only by re-starting VS 2015.
  • My app is MVC 5, not using any vNext stuff in my app, however I do have ASP.NET 5 RC1-Update 1 installed. I am using Typescript and .scss files.

    In the output window, I see the following logging info:

     'iisexpress.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\\Windows\\Microsoft.Net\\assembly\\GAC_32\\mscorlib\\v4.0_4.0.0.0__b77a5c561934e089\\mscorlib.dll'. Cannot find or open the PDB file. 'iisexpress.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\\Windows\\Microsoft.Net\\assembly\\GAC_32\\System.Web\\v4.0_4.0.0.0__b03f5f7f11d50a3a\\System.Web.dll'. Symbols loaded. 'iisexpress.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\\Windows\\Microsoft.Net\\assembly\\GAC_MSIL\\System\\v4.0_4.0.0.0__b77a5c561934e089\\System.dll'. Symbols loaded. 'iisexpress.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\\Windows\\Microsoft.Net\\assembly\\GAC_MSIL\\System.Core\\v4.0_4.0.0.0__b77a5c561934e089\\System.Core.dll'. Symbols loaded. 'iisexpress.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\\Windows\\Microsoft.Net\\assembly\\GAC_MSIL\\System.Web.ApplicationServices\\v4.0_4.0.0.0__31bf3856ad364e35\\System.Web.ApplicationServices.dll'. Symbols loaded. 'iisexpress.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\\Windows\\Microsoft.Net\\assembly\\GAC_MSIL\\System.Configuration\\v4.0_4.0.0.0__b03f5f7f11d50a3a\\System.Configuration.dll'. Symbols loaded. 'iisexpress.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\\Windows\\Microsoft.Net\\assembly\\GAC_MSIL\\System.Xml\\v4.0_4.0.0.0__b77a5c561934e089\\System.Xml.dll'. Symbols loaded. 'iisexpress.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\\Windows\\Microsoft.Net\\assembly\\GAC_MSIL\\System.Runtime.Caching\\v4.0_4.0.0.0__b03f5f7f11d50a3a\\System.Runtime.Caching.dll'. Symbols loaded. 'iisexpress.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\\Windows\\Microsoft.Net\\assembly\\GAC_MSIL\\Microsoft.Build.Utilities.v4.0\\v4.0_4.0.0.0__b03f5f7f11d50a3a\\Microsoft.Build.Utilities.v4.0.dll'. Cannot find or open the PDB file. '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'. Cannot find or open the PDB file. 'iisexpress.exe' (CLR v4.0.30319: /LM/W3SVC/3/ROOT-3-131015937881507859): Loaded 'C:\\Windows\\Microsoft.Net\\assembly\\GAC_32\\mscorlib\\v4.0_4.0.0.0__b77a5c561934e089\\mscorlib.dll'. Cannot find or open the PDB file. The thread 0x21ec has exited with code 0 (0x0). Exception thrown: 'System.CannotUnloadAppDomainException' in Unknown Module. Exception thrown: 'System.CannotUnloadAppDomainException' in Unknown Module.\n'iisexpress.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\\Windows\\Microsoft.Net\\assembly\\GAC_32\\mscorlib\\v4.0_4.0.0.0__b77a5c561934e089\\mscorlib.dll'. Cannot find or open the PDB file. 'iisexpress.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\\Windows\\Microsoft.Net\\assembly\\GAC_32\\System.Web\\v4.0_4.0.0.0__b03f5f7f11d50a3a\\System.Web.dll'. Symbols loaded. 'iisexpress.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\\Windows\\Microsoft.Net\\assembly\\GAC_MSIL\\System\\v4.0_4.0.0.0__b77a5c561934e089\\System.dll'. Symbols loaded. 'iisexpress.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\\Windows\\Microsoft.Net\\assembly\\GAC_MSIL\\System.Core\\v4.0_4.0.0.0__b77a5c561934e089\\System.Core.dll'. Symbols loaded. 'iisexpress.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\\Windows\\Microsoft.Net\\assembly\\GAC_MSIL\\System.Web.ApplicationServices\\v4.0_4.0.0.0__31bf3856ad364e35\\System.Web.ApplicationServices.dll'. Symbols loaded. 'iisexpress.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\\Windows\\Microsoft.Net\\assembly\\GAC_MSIL\\System.Configuration\\v4.0_4.0.0.0__b03f5f7f11d50a3a\\System.Configuration.dll'. Symbols loaded. 'iisexpress.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\\Windows\\Microsoft.Net\\assembly\\GAC_MSIL\\System.Xml\\v4.0_4.0.0.0__b77a5c561934e089\\System.Xml.dll'. Symbols loaded. 'iisexpress.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\\Windows\\Microsoft.Net\\assembly\\GAC_MSIL\\System.Runtime.Caching\\v4.0_4.0.0.0__b03f5f7f11d50a3a\\System.Runtime.Caching.dll'. Symbols loaded. 'iisexpress.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\\Windows\\Microsoft.Net\\assembly\\GAC_MSIL\\Microsoft.Build.Utilities.v4.0\\v4.0_4.0.0.0__b03f5f7f11d50a3a\\Microsoft.Build.Utilities.v4.0.dll'. Cannot find or open the PDB file. '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'. Cannot find or open the PDB file. 'iisexpress.exe' (CLR v4.0.30319: /LM/W3SVC/3/ROOT-3-131015937881507859): Loaded 'C:\\Windows\\Microsoft.Net\\assembly\\GAC_32\\mscorlib\\v4.0_4.0.0.0__b77a5c561934e089\\mscorlib.dll'. Cannot find or open the PDB file. The thread 0x21ec has exited with code 0 (0x0). Exception thrown: 'System.CannotUnloadAppDomainException' in Unknown Module. Exception thrown: 'System.CannotUnloadAppDomainException' in Unknown Module. 

    The last error repeats itself over and over, interspersed with the thread exit message. In the case of a successful launch of a debug session, this log output starts the same, but immediately after the loading of mscorlib are these lines:

     /ROOT-1-131015945372332716): Loaded 'C:\\Windows\\Microsoft.Net\\assembly\\GAC_32\\System.Web\\v4.0_4.0.0.0__b03f5f7f11d50a3a\\System.Web.dll'. Symbols loaded. 'iisexpress.exe' (CLR v4.0.30319: /LM/W3SVC/3/ROOT-1-131015945372332716): Loaded 'C:\\Windows\\Microsoft.Net\\assembly\\GAC_MSIL\\System\\v4.0_4.0.0.0__b77a5c561934e089\\System.dll'. Symbols loaded. 'iisexpress.exe' (CLR v4.0.30319: /LM/W3SVC/3/ROOT-1-131015945372332716): Loaded 'C:\\Windows\\Microsoft.Net\\assembly\\GAC_MSIL\\System.Core\\v4.0_4.0.0.0__b77a5c561934e089\\System.Core.dll'. Symbols loaded. 'iisexpress.exe' (CLR v4.0.30319: /LM/W3SVC/3/ROOT-1-131015945372332716): Loaded 'C:\\Windows\\Microsoft.Net\\assembly\\GAC_MSIL\\System.Web.ApplicationServices\\v4.0_4.0.0.0__31bf3856ad364e35\\System.Web.ApplicationServices.dll'. Symbols loaded. 

    (There are many other lines following these that I didn't show, in a successful session)

    This leads me to believe perhaps something is preventing the loading of System.Web, or something went wrong with the loading of mscorlib.

    Here's what I've tried:

  • Killing and re-starting IIS Express between debug runs - after killing IIS Express, and hitting F5 again, the process hangs before IIS exp ever gets re-started.
  • Un-installed, re-installed IIS Express 10
  • Disabled several VS extensions
  • Ran Repair on my .NET Framework 4.6.1 install
  • Removed/Re-installed ASP.NET 5 RC1-Update 1
  • Deleted .suo file, .vs folder, IIS temporary files
  • Had colleague reproduce on her machine, same behavior
  • Ran without debugging, same behavior

    Any clues would be greatly appreciated!

  • Well, after much hair-pulling this issue turned out to be related to Application Insights. I added AI to the app several months ago, with no issues. But recently there has been a problem accessing my Azure portal (company firewall issue I believe), that has prevented AI from properly logging in or accessing it's web components. My theory is that upon first run of the app, all is well but in the background the AI components are struggling to connect. Then when the app is closed, the components are not unloaded properly because they are hung on connection. Then upon the second run (only if I've rebuilt, for some reason), the init of the app fails due to the 'System.CannotUnloadAppDomainException' error.

    I don't understand it but I'm sure that removing all AI references has resolved the issue. Thanks for all who pondered this!

    The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

     
    粤ICP备18138465号  © 2020-2024 STACKOOM.COM