在 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. 844. Backspace String Compare

    class Solution { public: bool backspaceCompare(string S, string T) { int szs=S.size(); int szt=T.siz ...

  2. 如何查看Python内置模块的实现代码

    方法1:使用help(random) >>> import random >>> help(random) Help on module random: NAME ...

  3. ajax +jsp+iframe无刷新上传文件[转]

    http://hi.baidu.com/zj360202/blog/item/f23e3711f929c774cb80c475.html ajax jsp 无刷新上传文件 2009-10-26 16: ...

  4. Vue自定义指令报错:Failed to resolve directive: xxx

    Vue自定义指令报错 Failed to resolve directive: modle 这个报错有2个原因: 1.指令单词拼错 2.Vue.directive() 这个方法没有写在 new Vue ...

  5. Multiplexer

    definition  a device that selects one of several analog or digital input signals and forwards the se ...

  6. ZOJ 2132 The Most Frequent Number (贪心)

    题意:给定一个序列,里面有一个数字出现了超过 n / 2,问你是哪个数字,但是内存只有 1 M. 析:首先不能开数组,其实也是可以的了,后台数据没有那么大,每次申请内存就可以过了.正解应该是贪心,模拟 ...

  7. VSCode的终端修改

    快速打开VSCode的快捷键是:Ctrl + `(反引号) 转自:https://blog.csdn.net/u013517122/article/details/82776607 因本人实在忍受不了 ...

  8. Json跨域请求数-Jquery Ajax请求

    同步请求,async(是否异步) //同步请求,等待并接收返回的结果 var result = $.ajax({ type: "GET", url: address, async: ...

  9. .net 导出Excel

    CreateExcel(ExcelDs, ", f); void CreateExcel(DataSet ds, string typeid, string FileName) { Http ...

  10. 2.2.5synchronized代码间的同步性

    package com.cky.bean; /** * Created by chenkaiyang on 2017/12/6. */ public class ObjectService { pub ...