开发者

ASP.NET Web App using the wrong (2.0) CLR version (instead of 4.0)

I just deployed an asp.net 开发者_如何学Cweb 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!


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜