ASP.NET 5 MVC: unable to connect to web server 'IIS Express'

后端 未结 30 2145
北恋
北恋 2020-12-12 13:28

What I\'m doing:

  • Opening Visual Studio Community 2015
  • File -> New -> Project
  • Under Visual C#: Web -> ASP.NET Web Application
  • Web App
30条回答
  •  孤街浪徒
    2020-12-12 13:54

    I won't pretend to fully understand what MS bug creates this problem, but here is another potential solution:

    In the .vs/config/applicationHost.config file, find the section for . Under the pools, ensure that the managedRuntimeVersion attribute value matches the value which is in the IIS config for the system (and/or the version of the .NET framework which is installed).

    For example, you may find (as I did) that the generated file has:

        
    

    In my case, you would replace this with:

        
    

    Note the replacement from "v4.0" to "v4.0.30319". This resolved the issue.


    What appears to be going on:

    I believe that VS is generating an applicationHost.config file with "default" versions for the .NET framework, which may not match the specific version which is installed/configured on the system. You can debug/observe this issue by tracing the execution in Process Monitor, and finding the command line for iisexpress.exe. Running this command with /trace:error added yields a more informative message about a failure to preload the CLR with version v4.0. To wit:

    Starting IIS Express ...
    Failed while trying to preload CLR version v4.0. hr = 80131700
    Failed to initalize the W3WP_HOST hr = 80131700
    Process Model Shutdown called
    Unable to start iisexpress.


    Anyway, figured this might be helpful to someone else, since it's common enough to have multiple references online with bad information, and I've personally hit it a few times now.

提交回复
热议问题