Visual studio 2015 visual studio 2015 IIS Express无法调试asp.net 4项目

Visual studio 2015 visual studio 2015 IIS Express无法调试asp.net 4项目,visual-studio-2015,iis-express,application-pool,Visual Studio 2015,Iis Express,Application Pool,我使用VS 2013进行了两个项目。最近,我不得不切换到VS 2015,并在同一时间打开了这些项目。两个项目中的一个项目是.NET4.5Framework版本的项目,工作正常,我能够在IIS Express中进行调试。 但是,第二个项目--.net 4.0项目--我无法使用IIS express进行调试。 当我尝试调试时,我得到一个500错误 无法读取配置节“system.web.extensions”,因为它缺少节声明 在这个stackoverflow链接的帮助下,我成功地解决了这个特定的错误

我使用VS 2013进行了两个项目。最近,我不得不切换到VS 2015,并在同一时间打开了这些项目。两个项目中的一个项目是.NET4.5Framework版本的项目,工作正常,我能够在IIS Express中进行调试。 但是,第二个项目--.net 4.0项目--我无法使用IIS express进行调试。 当我尝试调试时,我得到一个500错误

无法读取配置节“system.web.extensions”,因为它缺少节声明

在这个stackoverflow链接的帮助下,我成功地解决了这个特定的错误

但我仍然无法调试,因为我遇到了另一个错误

无法识别的属性“targetFramework” 在这一行: 在web.config中


我找不到解决这个问题的办法。有些文章建议使用IIS解决方案,但不建议使用IIS Express。我无法理解为什么会发生这种情况,因为另一个项目(.net 4.5)工作正常,所以这不是IIS express framework配置的问题,而是与项目相关的问题。从vs 2013到vs 2015期间,我没有对代码进行任何更改。如何在vs2015中使用IIS express调试代码。最好不要更改web.config,因为这在生产服务器上运行良好。

打开IIS并更改应用程序池设置

选择右侧的.NET Framework版本,如下图所示:


首先,从web.config中的故障行中删除
targetFramework
`

IIS Express配置存储在每个解决方案的XML文件中。 在该文件中,您可以找到
部分并设置其
managedRuntimeVersion
属性

此文件位于“$(SolutionFolder)\.vs\applicationhost.config”中。请注意,.vs文件夹在默认情况下是隐藏的。 文件结构与此类似:

<configuration>
.
.
.

<system.applicationHost>

    <applicationPools>
        <add name="Clr4IntegratedAppPool" managedRuntimeVersion="v4.0" managedPipelineMode="Integrated" CLRConfigFile="%IIS_USER_HOME%\config\aspnet.config" autoStart="true" />
        <add name="Clr4ClassicAppPool" managedRuntimeVersion="v4.0" managedPipelineMode="Classic" CLRConfigFile="%IIS_USER_HOME%\config\aspnet.config" autoStart="true" />
        <add name="Clr2IntegratedAppPool" managedRuntimeVersion="v2.0" managedPipelineMode="Integrated" CLRConfigFile="%IIS_USER_HOME%\config\aspnet.config" autoStart="true" />
        <add name="Clr2ClassicAppPool" managedRuntimeVersion="v2.0" managedPipelineMode="Classic" CLRConfigFile="%IIS_USER_HOME%\config\aspnet.config" autoStart="true" />
        <add name="UnmanagedClassicAppPool" managedRuntimeVersion="" managedPipelineMode="Classic" autoStart="true" />
        <applicationPoolDefaults managedRuntimeLoader="v4.0">
            <processModel />
        </applicationPoolDefaults>
    </applicationPools>

   <sites>
        <site name="WebSite1" id="1" serverAutoStart="true">
            <application path="/" applicationPool="Clr4IntegratedAppPool">
                <virtualDirectory path="/" physicalPath="%IIS_SITES_HOME%\WebSite1" />
            </application>
            <bindings>
                <binding protocol="http" bindingInformation=":8080:localhost" />
            </bindings>
        </site>

.
.
.
</configuration>

.
.
.
.
.
.