与web.config中的targetFramework相关的配置错误 [英] Configuration Error related to targetFramework in web.config

查看:1019
本文介绍了与web.config中的targetFramework相关的配置错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在Visual Studio 2015中制作了一个MVC网站,并且可以在我的本地主机上运行.但是,当我发布自己的网站并将其放入主机时,它不起作用.它给了我这个错误通知:

I have made an MVC website in Visual Studio 2015 and it works in my localhost. But when I published my website and put into my host, it doesn't work. It gives me this error notice:

"/"应用程序中的服务器错误.

Server Error in '/' Application.

配置错误

解析器错误消息: Web.config文件的元素仅用于定位 .NET Framework 4.0版和更高版本(例如, "). "targetFramework" 属性当前引用的版本晚于 .NET Framework的已安装版本.指定有效的目标 .NET Framework版本,或安装所需版本的.NET Framework. .NET Framework.

Parser Error Message: The 'targetFramework' attribute in the element of the Web.config file is used only to target version 4.0 and later of the .NET Framework (for example, ''). 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.

源错误:

服务器上发生应用程序错误.当前的自定义错误 此应用程序的设置阻止了该应用程序的详细信息 远程查看错误(出于安全原因).它可以, 但是,可以由运行在本地服务器计算机上的浏览器查看.

An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

源文件:G:\ xxx \ xxx.com \ httpdocs \ web.config行:24

Source File: G:\xxx\xxx.com\httpdocs\web.config Line: 24

版本信息:Microsoft .NET Framework版本:4.0.30319; ASP.NET版本:4.0.30319.34248

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34248

我的web.config中的相关部分:

Related parts in my web.config:

  <configSections>
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --></configSections>

这部分有错误:

  <system.web>
    <authentication mode="None" />
    <customErrors mode="Off" />
    <compilation debug="true" targetFramework="4.6" />
    <httpRuntime targetFramework="4.6" />
  </system.web>

我的网站的属性:

和NuGet软件包管理器:

And NuGet Package Manager:

EntityFramework参考属性:

EntityFramework Reference Properties:

默认网站基本设置:(老实说,我不确定是否应在此处添加新网站(我的网站).)

Default Web Site Basic Settings: (To be honest, I am not sure whether I should add a new website(my website) in here.)

我已安装的.net框架:

My installed .net frameworks:

我的发布方法:

我已经在Internet上调查了此问题,并且发现了几个与我的问题相关的链接: Asp.net MCV4框架问题.在此链接中,有两个主要报价:

I have investigated this problem on the Internet and I have found several links related to my problem: Asp.net MCV4 framework issue. In this link, there are two main offers:

  1. 更改此编译标签

  1. changing this compilation tag

在IIS中更新应用程序池

updating application pool in IIS

实际上,我已尝试更改此标签,但它没有更改.然后,我控制了我的应用程序池,但它似乎是最新的.

Actually, I have tried to change this tag but it doesn't change. Then I have controlled my application pool but it seems up-to-date.

我已经致电我的主机提供商,并且已经解释了我的问题.他们说此错误与他们的服务器无关.

I have called my host provider and I have explained my problem. They say that this error is not related to their servers.

我该怎么办?解决方案是什么?

What should I do? What is the solution for this?

推荐答案

您的网站项目的目标是.Net Framework v4.6,但您的托管服务提供商尚未安装此版本.您的选择:

Your website project is targeting v4.6 of the .Net Framework but your hosting provider has not yet installed this version. Your options:

  1. 要求提供商安装它-他们不太可能这样做.
  2. 找到另一个支持它的提供商.
  3. 将项目更改为目标v4.5.

这篇关于与web.config中的targetFramework相关的配置错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆