2

I just deployed an asp.net web app I have been working on to a new dev machine. It's a 4.0 project converted from 3.5. For some reason, I get the following error when I try to hit the site via my IIS website under the Default Website:

Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive.

It lists this as being a config error on the ASP.NET error page:

 <compilation debug="true" targetFramework="4.0"/>

However, I notice that at the bottom of the error page, the version information indicates that it is using version 2 instead of version 4. Anyone have ideas about how to fix this?

I have made sure that my default website usese a .net 4 / integrated app pool and i cycled iis after this change was made. Still not luck. Here is my entire web.config file:

    <?xml version="1.0"?>
<configuration>
    <appSettings/>
    <connectionStrings>
        <add name="EventMasterConnectionString" connectionString="Data Source=localhost;Initial Catalog=BashBidder;Integrated Security=True" providerName="System.Data.SqlClient"/>
    </connectionStrings>
    <system.web>
        <!-- 
            Set compilation debug="true" to insert debugging 
            symbols into the compiled page. Because this 
            affects performance, set this value to true only 
            during development.
        -->
        <compilation debug="true" targetFramework="4.0">
        </compilation>
        <!--
            The <authentication> section enables configuration 
            of the security authentication mode used by 
            ASP.NET to identify an incoming user. 
        -->
        <authentication mode="Windows"/>
        <!--
            The <customErrors> section enables configuration 
            of what to do if/when an unhandled error occurs 
            during the execution of a request. Specifically, 
            it enables developers to configure html error pages 
            to be displayed in place of a error stack trace.

        <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
            <error statusCode="403" redirect="NoAccess.htm" />
            <error statusCode="404" redirect="FileNotFound.htm" />
        </customErrors>
        -->
        <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/></system.web>
    <!-- 
        The system.webServer section is required for running ASP.NET AJAX under Internet
        Information Services 7.0.  It is not necessary for previous version of IIS.
    -->
</configuration>

Thanks for the help!

kmehta
  • 2,457
  • 6
  • 31
  • 37

1 Answers1

2

You have to configure your application pool so it uses version 4.0 of the framework.

This procedure explains how to do it on IIS 7, and that one on IIS 6.

Frédéric Hamidi
  • 258,201
  • 41
  • 486
  • 479
  • Huh? I believe the OP wants to run his application in version 4.0. – Victor Feb 13 '11 at 15:42
  • @Victor, good catch, got the question inverted somehow. Answer updated, thanks for the heads-up :) – Frédéric Hamidi Feb 13 '11 at 15:54
  • Thanks. The app pool is already targeted at version 4, and not version 2. Still no luck. – kmehta Feb 13 '11 at 16:40
  • You're right. Turns out that there was an error in my webform markup that was causing this. More developments however. I am now getting a 501.19 saying that the config file is invalid (the actual error is that the config file cannot be read). My app runs fine if i hit f5 and let it generate a server address and port from withing VS...but if i try to go through my IIS virtual directory, i get the config error. Any ideas on that? – kmehta Feb 13 '11 at 17:07
  • Ugh. Scratch that. All is well now. I forgot that I changed the project name and did not update the path of my VD. Thanks for your time. – kmehta Feb 13 '11 at 17:20