【问题标题】:visual studio 2015 IIS Express cannot debug asp.net 4 projectvisual studio 2015 IIS Express 无法调试 asp.net 4 项目
【发布时间】:2017-10-31 19:33:12
【问题描述】:

我正在使用 VS 2013 处理 2 个项目。最近我不得不切换到 VS 2015 并以相同的方式打开这些项目。 2 个项目之一,即 .net 4.5 框架版本项目工作正常,我能够在 IIS Express 中进行调试。 但是,第二个项目 - .net 4.0 项目 - 我无法使用 IIS express 进行调试。 当我尝试调试时,出现 500 错误

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

在此 stackoverflow 链接 The configuration section 'system.web.extensions' cannot be read because it is missing a section declaration 的帮助下,我设法解决了该特定错误

但由于出现另一个错误,我仍然无法调试

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

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

【问题讨论】:

    标签: visual-studio-2015 iis-express application-pool


    【解决方案1】:

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

    IIS Express 配置存储在每个解决方案的 XML 文件中。 在该文件中,您可以找到<applicationPools> 部分并设置其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>
    

    【讨论】:

      【解决方案2】:

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

      选择正确的.NET Framework版本如下图:

      【讨论】:

        猜你喜欢
        • 2016-08-25
        • 2016-05-03
        • 1970-01-01
        • 1970-01-01
        • 2016-11-13
        • 2021-02-10
        • 2017-09-03
        • 1970-01-01
        • 2016-06-28
        相关资源
        最近更新 更多