把应用程序升级至.NET Framework 4.0之后,出现一个问题,即是Web.config文件中的Compilation 节点配置不正确。
需要在Compilation 添加一个属性targetFrameworkMoniker,另外,还要把这个节点内的属性有包含3.5的删除。最终结果: <compilation debug="false" targetFrameworkMoniker=".NETFramework,Version=v4.0">

Server Error in '/' Application.


The application domain or application pool is currently running version 4.0 or later of the .NET Framework. This can occur if IIS settings have been set to 4.0 or later for this Web application, or if you are using version 4.0 or later of the ASP.NET Web Development Server. The <compilation> element in the Web.config file for this Web application does not contain the required 'targetFrameworkMoniker' attribute for this version of the .NET Framework (for example, '<compilation targetFrameworkMoniker=".NETFramework,Version=v4.0">'). Update the Web.config file with this attribute, or configure the Web application to use a different version of the .NET Framework.

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.Configuration.ConfigurationErrorsException: The application domain or application pool is currently running version 4.0 or later of the .NET Framework. This can occur if IIS settings have been set to 4.0 or later for this Web application, or if you are using version 4.0 or later of the ASP.NET Web Development Server. The <compilation> element in the Web.config file for this Web application does not contain the required 'targetFrameworkMoniker' attribute for this version of the .NET Framework (for example, '<compilation targetFrameworkMoniker=".NETFramework,Version=v4.0">'). Update the Web.config file with this attribute, or configure the Web application to use a different version of the .NET Framework.

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:

[ConfigurationErrorsException: The application domain or application pool is currently running version 4.0 or later of the .NET Framework. This can occur if IIS settings have been set to 4.0 or later for this Web application, or if you are using version 4.0 or later of the ASP.NET Web Development Server. The <compilation> element in the Web.config file for this Web application does not contain the required 'targetFrameworkMoniker' attribute for this version of the .NET Framework (for example, '<compilation targetFrameworkMoniker=".NETFramework,Version=v4.0">'). Update the Web.config file with this attribute, or configure the Web application to use a different version of the .NET Framework.]System.Web.Compilation.MultiTargetingUtil.InitializeTargetFrameworkNameFor20Or35() +3027367System.Web.Compilation.MultiTargetingUtil.InitializeTargetFrameworkName() +101System.Web.Compilation.MultiTargetingUtil.EnsureFrameworkNamesInitialized() +95System.Web.Compilation.BuildManager.Initialize() +192System.Web.Compilation.BuildManager.InitializeBuildManager() +246System.Web.HttpRuntime.HostingInit(HostingEnvironmentFlags hostingFlags, PolicyLevel policyLevel, Exception appDomainCreationException) +484[HttpException (0x80004005): The application domain or application pool is currently running version 4.0 or later of the .NET Framework. This can occur if IIS settings have been set to 4.0 or later for this Web application, or if you are using version 4.0 or later of the ASP.NET Web Development Server. The <compilation> element in the Web.config file for this Web application does not contain the required 'targetFrameworkMoniker' attribute for this version of the .NET Framework (for example, '<compilation targetFrameworkMoniker=".NETFramework,Version=v4.0">'). Update the Web.config file with this attribute, or configure the Web application to use a different version of the .NET Framework.]System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9597080System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +91System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +324

Version Information: Microsoft .NET Framework Version:4.0.20506; ASP.NET Version:4.0.20506.1

转载于:https://www.cnblogs.com/insus/archive/2009/09/03/1559239.html

compilation targetFrameworkMoniker=.NETFramework,Version=v4.0相关推荐

  1. vs2022,python,找不到 .NETFramework,Version=v4.0 的引用程序集。

    旧的vs2019创建的python 项目,用vs2022打开编译出现如下错误. 严重性 代码 说明 项目 文件 行 禁止显示状态 错误 找不到 .NETFramework,Version=v4.0 的 ...

  2. C++学习(三五二)未找到框架“.NETFramework,Version=v4.0”的引用程序集

    C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.Curr ...

  3. VS2022打开项目之后提示:找不到 .NETFramework,Version=v4.0 的引用程序集。要解决此问题,请为此框架版本安装开发人员工具包(SDK/目标包)或者重新定向应用程序。

    问题: 使用 vs2022打开带有.net4.0的项目会报错 严重性 代码 说明 项目 文件 行 列 禁止显示状态 错误 MSB3644 找不到 .NETFramework,Version=v4.0 ...

  4. 指向“netstandard2.0”。它不能被指向“.NETFramework,Version=v4.0”的项目引用 必须添加对程序集 netstandard

    netstandard2.0  只能被 .NETFramework 4.6.1 ++版本 引用

  5. 关于未能找到源文件“.NETFramework,Version=v4.0.AssemblyAttributes.cs”问题

    为了解决上述问题,找资料找了一下午,修复vs也解决不了,出现此问题是由于手动更改了"C:\Users\xxx\AppData\Local"文件权限的问题,什么显示呀,隐藏呀,解决测 ...

  6. 未能解析引用的程序集......因为它对不在当前目标框架“.NETFramework,Version=v4.0,Profile=Client”中的 (转)...

    解决方法:资源管理器下点击项目名(右键)属性--将.NET Framework 4 Client Profile改成.NET Framework 4 . 传送门:http://bbs.csdn.net ...

  7. VS中使用NuGet安装依赖时提示:无法安装程序包“xxx”。你正在尝试将此程序包安装到目标为“.NETFramework,Version=v4.5”的项目中

    场景 在使用NuGet添加项目依赖,比如添加MQTTnet时提示: 安装程序包"MQTTnet3.0.0".你正在尝试将此程序包安装到目标为".NETFramework, ...

  8. 解决 VS 出现错误 MSB3644 找不到 .NETFramework,Version=v4.6.1 的引用程序集。要解决此问题,请为此框架版本安装......

    环境 VS 2022 错误 MSB3644 找不到 .NETFramework,Version=v4.6.1 的引用程序集.要解决此问题,请为此框架版本安装- MSB3644 找不到 .NETFram ...

  9. 未能解析主引用“Fiddler”,因为它是针对“.NETFramework,Version=v4.6.1”框架生成的。该框架版本高于当前目标框架“.NETFramework,Version=v4.5

    警告        未能解析主引用"Fiddler",因为它是针对".NETFramework,Version=v4.6.1"框架生成的.该框架版本高于当前目标 ...

最新文章

  1. ZEGO即构科技携小程序连麦直播方案亮相GMIC
  2. python django flask_Flask 与 Django 的简单对比
  3. 拼团小程序源码_纯小白如何做一个摄影电商拼团小程序?
  4. 数字IC设计bilibili-Designer Compiler的理论笔记+实操
  5. 都兰县第一中学计算机,都兰县第一中学教案.doc
  6. css 实现居中的五种方式
  7. 腾讯 Github 全球贡献前十;三星可折叠手机售价 1.6 万;OpenTitan 正式开源|极客头条...
  8. 如何攻克 Android 调试难题?| 技术头条
  9. php http/1.1 403 forbidden in,http常用方法有哪些
  10. 机器学习算法:马尔可夫链
  11. HTML+css中鼠标经过触发等问题
  12. springMVC实现图片打包下载
  13. xampp如何设置多虚拟主机访问
  14. linux运维(九)
  15. 智源社区AI周刊No.105:谷歌FLAN-T5 30亿参数即超越GPT-3性能;Copilot推出语音编程新功能,但面临诉讼...
  16. CSP漫画工作室clipstudiopaint最新版本2022功能介绍
  17. HTML 之 块级元素、行内元素和行内块元素之间的嵌套规则
  18. 毕业设计有哪些可借鉴的 GitHub 项目?
  19. 中文字幕人工翻译 Lynda-After Effects CC 2019 Essential Training Motion Graphics
  20. 结构体指针变量的定义

热门文章

  1. 2.10 是否要使用端到端的深度学习
  2. 1.7 什么时候该改变开发_测试集和指标
  3. VMware Horizon7安装-分步指南
  4. vsan主机高级优化参数配置
  5. vcsa上RVC查看vsan状态的命令
  6. Java设计模式学习总结(13)——结构型模式之享元模式
  7. Maven学习总结(43)——利用javadoc插件生成项目的API文档
  8. App后台开发运维和架构实践学习总结(1)——App后台核心技术之用户验证方案
  9. matlab实训心得体会,MatLab实习心得体会
  10. js html模板生成图片不显示,网页中图片不显示问题