在 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. java测试ATM自助操作系统

    开学第一周系主任安排了一项测试,测试要求:模拟ATM自助取款机用文件进行存储账户信息,密码等,并进行存款取款,转账,查询记录等操作,而且要进行文件的读取与录入. 这是一个ATM自助取款的操作系统,进行 ...

  2. delphi 10 seattle 安卓服务开发(一)

    从delphi 开始支持安卓的开发开始, 安卓service 开发一直都是delphier 绕不过去的坎, 以前也有开发service  的方法,但是都是手工处理启动文件,而且要修改很多东西,基本上成 ...

  3. Github 快速上手实战教程

    一.实验介绍 1.1 实验内容 本次课程讲的是在实验楼的在线环境中,如何使用 Github 去管理在在线环境中使用的代码.配置.资源等实验相关文件,怎样去添加.同步和下拉在远程仓库中的实验文件,以此来 ...

  4. hdu-1042(大数+万进制)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1042 参考文章:https://blog.csdn.net/tigerisland45/article ...

  5. CHAPITRE II

    J'ai ainsi vécu seul, sans personne avec qui parler véritablement, jusqu'à une panne[pan][机]故障 dans ...

  6. Educational Codeforces Round 61 F 思维 + 区间dp

    https://codeforces.com/contest/1132/problem/F 思维 + 区间dp 题意 给一个长度为n的字符串(<=500),每次选择消去字符,连续相同的字符可以同 ...

  7. boost-使用property_tree来解析xml、json

    property_tree是一个保存了多个属性值的树形数据结构,可以用来解析xml.json.ini.info文件.要使用property_tree和xml解析组件的话需要包含"boost/ ...

  8. form表单序列化为json格式数据

    在web开发过程中,经常遇到将form序列化不能格式的字符串提交到后台,下面就介绍怎样将form表单序列化为json字符串. 首先,是扩展的jquery序列化插件,依赖jquery.经测试,这段代码可 ...

  9. OkHttp3几个简单的例子和在子线程更新UI线程的方法

    okHttp用于android的http请求.据说很厉害,我们来一起尝尝鲜.但是使用okHttp也会有一些小坑,后面会讲到如何掉进坑里并爬出来. 首先需要了解一点,这里说的UI线程和主线程是一回事儿. ...

  10. MapServer和GeoServer对比

    https://blog.csdn.net/theonegis/article/details/45823099