提示信息如下
Server Error in '/' Application.
--------------------------------------------------------------------------------Configuration Error 
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. Parser Error Message: The 'targetFramework' attribute in the <compilation> element of the Web.config file is used only to target version 4.0 and later of the .NET Framework (for example, '<compilation targetFramework="4.0">'). The 'targetFramework' attribute currently references a version that is later than the installed version of the .NET Framework. Specify a valid target version of the .NET Framework, or install the required version of the .NET Framework.Source Error: 
Line 21:   -->
Line 22:   <system.web>
Line 23:     <compilation targetFramework="4.5"/>
Line 24:     <httpRuntime/>
Line 25:     <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
 Source File: E:\KnowLedgePublic\web.config    Line: 23 
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1 我把.net framwork版本改成4.0以后 也报错提示如下
Server Error in '/' Application.
--------------------------------------------------------------------------------The assembly 'System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' does not contain a Web resource that has the name 'MsAjaxBundle'. Make sure that the resource name is spelled correctly. Make sure that the application references the correct version of an ASP.NET AJAX Framework assembly. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.InvalidOperationException: The assembly 'System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' does not contain a Web resource that has the name 'MsAjaxBundle'. Make sure that the resource name is spelled correctly. Make sure that the application references the correct version of an ASP.NET AJAX Framework assembly.Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  Stack Trace: 
[InvalidOperationException: The assembly 'System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' does not contain a Web resource that has the name 'MsAjaxBundle'. Make sure that the resource name is spelled correctly. Make sure that the application references the correct version of an ASP.NET AJAX Framework assembly.]
   System.Web.UI.WebResourceUtil.VerifyAssemblyContainsReleaseWebResource(Assembly assembly, String releaseResourceName, Assembly currentAjaxAssembly) +463970
   System.Web.UI.ScriptReference.ShouldUseDebugScript(String releaseName, Assembly assembly, Boolean isDebuggingEnabled, Assembly currentAjaxAssembly) +86
   System.Web.UI.ScriptReference.DetermineResourceNameAndAssembly(ScriptManager scriptManager, Boolean isDebuggingEnabled, String& resourceName, Assembly& assembly) +99
   System.Web.UI.ScriptReference.GetUrlFromName(ScriptManager scriptManager, IControl scriptManagerControl, Boolean zip) +103
   System.Web.UI.ScriptReference.GetUrlInternal(ScriptManager scriptManager, Boolean zip) +613
   System.Web.UI.ScriptReference.GetUrl(ScriptManager scriptManager, Boolean zip) +213
   System.Web.UI.ScriptManager.RegisterUniqueScripts(List`1 uniqueScripts) +202
   System.Web.UI.ScriptManager.RegisterScripts() +444
   System.Web.UI.ScriptManager.OnPagePreRenderComplete(Object sender, EventArgs e) +122
   System.Web.UI.Page.OnPreRenderComplete(EventArgs e) +8872170
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2716 
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1 

解决方案 »

  1.   

    <compilation targetFramework="4.5"/>
    很明显你开发的web版本是.net framwork4.5 你改成4.0当然报错了
      

  2.   

    vs2012默认是4.5版本 楼主把框架改成4.0就可以发布了 但是不知道楼主有没有用到4.5里面特有的功能 没有的话就改成4.0吧 4.5感觉不怎么稳定 前几个月用vs2012创建4.5的项目还出问题
      

  3.   

    four_year 我用4.0的时候报的那个错误你遇到过吗?能不能给指点一下!!!
      

  4.   

    IIS没有正确的注册.net。
    或则你的应用程序池没有选择正确的版本。
      

  5.   

    补充下;在2003下已经装了.net v4.0.30319的版本,应用程序池也单独建了4.0的
      

  6.   

    服务器上装4.5,然后重新注册到iis
      

  7.   

    你先确保,服务器,和你本机开发环境,。net 版本一直,