1

I was working on 2 projects using VS 2013. Recently I had to switch to VS 2015 and opened these projects in the same. One of the 2 project, which is a .net 4.5 framework version project works fine, and I am able to debug in IIS Express. However, the second project - .net 4.0 project - I cannot debug using IIS express. When I try to debug I get a 500 error

The configuration section 'system.web.extensions' cannot be read because it is missing a section declaration

I managed to resolve that particular error with help from this stackoverflow link The configuration section 'system.web.extensions' cannot be read because it is missing a section declaration

But still I could not debug as I got another error

Unrecognized attribute 'targetFramework' at this line : in web.config

I am not able find a solution to this problem. there are some articles which suggest solutions for IIS, but not for IIS Express. I am not able to understand why this happens, as the other project (.net 4.5) works fine, so this is not a problem with IIS express framework config, but project related. I did not make any changes to code whiles moving from vs 2013 to vs 2015. What can I do to debug the code using IIS express in vs2015. preferably by not making changes to web.config as this is working fine on the production server.

2 Answers 2

1

First, you remove the targetFramework from the trouble line in the web.config`

IIS Express configuration is stored in an XML file for each solution. In that file, you can find <applicationPools> section and set their managedRuntimeVersion attribute.

This file is located in your "$(SolutionFolder)\.vs\applicationhost.config". Note that the ".vs" folder is hidden by default. The file structure is similar to this:

<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>
Sign up to request clarification or add additional context in comments.

Comments

0

Open your IIS and change your Application pool setting.

Select the right .NET Framework version as the image shown below:

enter image description here

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.