在 VS2013 下开发的 MVC4 网站,基于 .net 4.5,服务器是一台 Windows 2008 R2,运行的时候就报错了

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.

<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>

因为2008 R2默认只安装了.Net 4,升级.Net 4.5再重新注册到IIS应该可以解决,但服务器上不能随便升级,所以我们需要修改一下配置:

<system.web>
<compilation debug="true" />
<httpRuntime targetFramework="4.0" />
</system.web>

compilation是编译设置,在部署环境无须设置 targetFramework,当然 debug 也可以设置成 false

httpRuntime是运行时,我们知道 .Net 4.0 和 .Net 4.5 的运行时版本都是 .Net 4.0,所以改成4.0就OK了

<compilation debug="true" targetFramework="4.5"> 报错解决方案的更多相关文章

  1. IIS 发布网站出现<compilation debug="true" targetFramework="4.6.1">错误

    参考:http://www.mamicode.com/info-detail-1180214.html 原因是环境只安装到.net Framework 4.5 的版本(.net版本向下兼容 ) 解决方 ...

  2. <compilation debug="true" targetFramework="4.5.2"> 报错解决方案

    有的时候新建项目,默认会选择比较高的 .net framework 版本如 4.5.2 有的时候发布项目就会遇到这个问题 解决的话 改成4.0就行了! 看你发布在哪里,如果在本地或者服务器,只要去下载 ...

  3. c#代码获取web.config配置文件里面设置的 <compilation debug="true"节点

    == 在我们的web.config文件中,有像下面的这样的一个配置, <system.web> <identity impersonate="true" user ...

  4. .net 网站发布 Web.Config中的<compilation debug="true"/>

    Web.Config中的<compilation debug="true"/> <compilation debug="true"/> ...

  5. cocoapod引入FLEX,debug模式正常,Release报错library not found for -lXXX

    cocoapod引入FLEX,debug模式正常,Release报错library not found for -lXXX, 因为podfile是这么写的: pod 'FLEX', '~> 2. ...

  6. RabbitMQ>Erlang machine stopped instantly (distribution name conflict?). The service is not restarted as OnFail is set to ignore.-报错解决方案 原来是NNND。。。

    >Erlang machine stopped instantly (distribution name conflict?). The service is not restarted as ...

  7. Updates were rejected because the remote contains work that you do(git报错解决方案)

    Updates were rejected because the remote contains work that you do(git报错解决方案) 今天向GitHub远程仓库提交本地项目文件时 ...

  8. JMeter 报告监听器导入.jtl结果文件报错解决方案

    JMeter 报告监听器导入.jtl结果文件报错解决方案   by:授客 QQ:1033553122   1. 问题描述 把jmeter压测时生成的 .jtl结果文件导入监听器报告中,弹出如下错误提示 ...

  9. Python3.x:import urllib2报错解决方案

    Python:import urllib2报错解决方案 python2和3有些不一样: python2:输出为print 'hello world' python3:输出为print('hello w ...

随机推荐

  1. KM匹配板子

    /* gyt Live up to every day */ #include<cstdio> #include<cmath> #include<iostream> ...

  2. VS2012智能感知变英文解决办法

    解决办法: 1.从一台没装.NET3.5的机子上复制C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\zh-CN路径下的文件覆盖就可以 2.或者重装中文版的f ...

  3. 鼠标经过,显示悬浮DIV

    属牛人的本命佛是虚空藏菩萨.属牛人可佩戴属牛黄玉本命佛来提升财运,黄玉的金黄色代表蒸蒸日上,而“金黄”也就是“黄金”的到(倒)来,象征着富贵与财气,佩戴可以招财招富贵,同时黄玉亦是希望之石,可带来智慧 ...

  4. web项目文件夹上传

    最近公司做工程项目,实现文件夹上传 网上找了很久,发现网上很多代码大都存在很多问题,不过还是让我找到了一个符合要求的项目. 对项目的文件夹上传功能做出分析,找出文件夹上传的原理,对文件夹的传输模式深入 ...

  5. 模板引擎(smarty)知识点总结四

    /*   smarty 引入对象 */ require_once 'libs/Smarty.class.php';  require 'MySmarty.class.php';  $msma = ne ...

  6. 常用模块xml,shelve,configparser,hashlib

    XML 什么XML:全称 可扩展标记语言 标记指的是代表某种含义的字符 XML<> 为什么需要XML 为能够在不同的平台间继续数据的交换 为了使交换的数据能让对方看懂 就需要按照一定的语法 ...

  7. Ng第十一课:机器学习系统的设计(Machine Learning System Design)

    11.1  首先要做什么 11.2  误差分析 11.3  类偏斜的误差度量 11.4  查全率和查准率之间的权衡 11.5  机器学习的数据 11.1  首先要做什么 在接下来的视频将谈到机器学习系 ...

  8. postman接口功能测试

    前言                                                         之前还没实际做过接口测试的时候呢,对接口测试这个概念比较渺茫,只能靠百度,查看各种 ...

  9. JavaScript 获取鼠标点击位置坐标

    在一些DOM操作中我们经常会跟元素的位置打交道,鼠标交互式一个经常用到的方面,令人失望的是不同的浏览器下会有不同的结果甚至是有的浏览器下没结果,这篇文章就上鼠标点击位置坐标获取做一些简单的总结,没特殊 ...

  10. Hdu1083 Courses

    Courses Problem Description Consider a group of N students and P courses. Each student visits zero, ...