2015-10-29 10 views
21

Ho creato un sito Web MVC in Visual Studio 2015 e funziona nel mio localhost. Ma quando ho pubblicato il mio sito Web e inserito nel mio host, non funziona. Mi dà questo avviso di errore:Errore di configurazione relativo a targetFramework in web.config

Server Error in '/' Application.

Configuration Error

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.

Source Error:

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.

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

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

parti correlate nel mio 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> 

E questa parte con l'errore:

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

Proprietà del mio sito:

enter image description here

.210

E NuGet Package Manager:

enter image description here

EntityFramework Riferimento Proprietà: Sito Web

enter image description here

default Impostazioni di base: (Per essere onesti, io non sono sicuro se devo aggiungere un nuovo sito web (il mio sito web) in qui.)

enter image description here

miei quadri installati .net:

enter image description here

il mio metodo: pubblicare

enter image description here

Ho studiato questo problema su Internet e ho trovato diversi link relativi al mio problema: Asp.net MCV4 framework issue. In questo link, ci sono due offerte principali:

  1. mutevoli questo tag di compilazione

  2. pool di applicazioni aggiornamento nel IIS

In realtà, ho cercato di cambiare questo tag, ma doesn cambiare. Quindi ho controllato il mio pool di applicazioni ma sembra aggiornato.

enter image description here

ho chiamato il mio fornitore ospite e ho spiegato il mio problema. Dicono che questo errore non è correlato ai loro server.

Cosa devo fare? Qual è la soluzione per questo?

Grazie in anticipo.

+1

Is .Net Framework 4.6 installato sul server? – DavidG

+0

@DavidG ad essere onesti, non ho chiesto questo mio fornitore host. ma in localhost .net framework 6 è installato. sto aggiungendo la sua immagine. – rockenpeace

+0

Quindi stai dicendo che quando pubblichi sul tuo IIS locale, non funziona? O solo quando pubblichi sul tuo hosting provider? – DavidG

risposta

29

Il progetto del tuo sito web è destinato alla v4.6 di .Net Framework ma il tuo provider di hosting non ha ancora installato questa versione.Le tue opzioni:

  1. Chiedere al provider di installarlo, è improbabile che lo faccia.
  2. Trova un altro provider che lo supporta.
  3. Cambia il tuo progetto a target v4.5.
6

@DavidG ha giustamente indicato tutte le cose. Solo sul lato informativo se IIS è il tuo provider, allora l'installazione della piattaforma Web è la soluzione migliore per verificare lo stato corrente di ciò che tutti sono installati sulla tua macchina al momento. Dai un'occhiata al snapshot qui sotto -

enter image description here

E 'davvero a portata di mano per controllare che cosa tutto manca e si può far ripartire l'installazione di tutti i pezzi mancanti in un solo click.

1

Ho appena avuto un problema simile dopo l'aggiornamento di Windows() di installazione della KB 3205402.

grande differenza con il mio caso: l'applicazione ha funzionato bene prima dell'aggiornamento!

==> Ho trovato in "Gestione IIS", in "Restrizioni ISAPI e CGI", che il framework ASP.NET v4.0.30319 è stato impostato su "non autorizzato"!

Passare a "Autorizzato" ha risolto il problema

Problemi correlati