2012-11-23 2 views
6

Ho creato una nuova applicazione ASP.NET MVC 4 basata sul modello di applicazione Internet, potrei eseguirlo correttamente e autenticare l'utente da VS 2012 Express.Il carico del sito Web MVC 4 mostra errore HTTP 500.19

Quindi lo ha pubblicato in una cartella in wwwroot, quindi in IIS 7.5 il gestore ha creato una directory virtuale che punta a tale cartella e la ha convertita in un'applicazione utilizzando un pool integrato 4.0 separato.

Quando ho cercato di esplorare l'applicazione dall'interno del responsabile di IIS ottengo l'errore successivo:

HTTP Error 500.19 - Internal Server Error, La pagina richiesta non è possibile accedere perché i dati relativi alla configurazione per la pagina non sono non valido.

Errore di configurazione: Impossibile aggiungere la voce insieme duplicato di tipo 'add' con unico attributo 'name' chiave impostata su 'ExtensionlessUrlHandler-integrato-4.0'

Config fonte:

56:  <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0"/> 
57:  <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode,runtimeVersionv4.0" /> 
58:  </handlers> 

searched here, ho trovato la risposta corrispondente:

Risoluzione 1

Eliminare l'ele XML malformati dal file ApplicationHost.config o dal file Web.config.

mio file web.config è come qui sotto:

<?xml version="1.0"?> 
    <configuration> 
     <configSections> 
     <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/> 
     </configSections> 
     <connectionStrings> 
     <add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-digixMVC4-20120915233326;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-digixMVC4-20120915233326.mdf" providerName="System.Data.SqlClient"/> 
     </connectionStrings> 
     <appSettings> 
     <add key="webpages:Version" value="2.0.0.0"/> 
     <add key="webpages:Enabled" value="false"/> 
     <add key="PreserveLoginUrl" value="true"/> 
     <add key="ClientValidationEnabled" value="true"/> 
     <add key="UnobtrusiveJavaScriptEnabled" value="true"/> 
     </appSettings> 

     <!-- 
     The following attributes can be set on the <httpRuntime> tag. 
      <system.Web> 
      <httpRuntime targetFramework="4.5"/> 
      </system.Web> 
     --> 
     <system.web> 
     <compilation targetFramework="4.5"/> 
     <httpRuntime/> 
     <authentication mode="Forms"> 
      <forms loginUrl="~/Account/Login" timeout="2880"/> 
     </authentication> 
     <pages controlRenderingCompatibilityVersion="4.0"> 
      <namespaces> 
      <add namespace="System.Web.Helpers"/> 
      <add namespace="System.Web.Mvc"/> 
      <add namespace="System.Web.Mvc.Ajax"/> 
      <add namespace="System.Web.Mvc.Html"/> 
      <add namespace="System.Web.Optimization"/> 
      <add namespace="System.Web.Routing"/> 
      <add namespace="System.Web.WebPages"/> 
      </namespaces> 
     </pages> 
     </system.web> 
     <system.webServer> 
     <validation validateIntegratedModeConfiguration="false"/> 
     <handlers> 
      <remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit"/> 
      <remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit"/> 
      <remove name="ExtensionlessUrlHandler-Integrated-4.0"/> 
      <add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0"/> 
      <add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0"/> 
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0"/> 
      <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode,runtimeVersionv4.0" />  
     </handlers> 
     </system.webServer> 
     <runtime> 
     <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> 
      <dependentAssembly> 
      <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364g85"/> 
      <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0"/> 
      </dependentAssembly> 
      <dependentAssembly> 
      <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364g85"/> 
      <bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.0.0.0"/> 
      </dependentAssembly> 
      <dependentAssembly> 
      <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364g85"/> 
      <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0"/> 
      </dependentAssembly> 
     </assemblyBinding> 
     </runtime> 
     <entityFramework> 
     <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework"/> 
     </entityFramework> 
    </configuration> 

Come io sono uno sviluppatore poco abile a MVC 4, vorrei chiedere se qualcuno potesse scoprire l'elemento XML non valido nel file di cui sopra.

risposta

5

hai lo stesso nome in due volte. il nome deve essere unico

config corrente

<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0"/> 

<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode,runtimeVersionv4.0" /> 

modifica

<add name="ExtensionlessUrlHandler-Integrated-4.0a" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0"/> 

<add name="ExtensionlessUrlHandler-Integrated-4.0b" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode,runtimeVersionv4.0" /> 
+1

non vedo lo stesso nome due volte, non v'è diverso _32bit postfix o _64bit. È questo postfix in qualche modo magico? – qub1n

+0

Il problema si verifica anche per me. Anch'io ho il suffisso _32bit/_64bit, tuttavia la modifica delle stringhe in qualsiasi modo risolverà il problema, purché entrambe le stringhe vengano modificate. I due possono avere lo stesso corpo esatto ma mantenere il postfix originale _32bit/_64bit e funzionerà ancora, il che mi dice che non è * un * prefisso magico. Sospetto che stia controllando le corrispondenze tra altri progetti nella soluzione/sul server. Quello, o qualcosa di strano sta succedendo in IIS. – 16807

+0

Capito dopo aver letto questo: http://stackoverflow.com/questions/26271958/what-doesextensionlessurlhandler-do-in-an-mvc-application. L'ordine dei tag di aggiunta/rimozione sembra apparentemente importante. Stavo aggiungendo ExtensionlessUrlHandlers prima di rimuovere i valori predefiniti esistenti forniti da IIS. I valori di default avevano lo stesso nome dei gestori che ho aggiunto, quindi l'errore. – 16807

6

Questo è vero per ASP.NET 5.2 WebAPI troppo ..

ho avuto

<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" /> 
    <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" /> 

Quale ho cambiato a

<add name="ExtensionlessUrlHandler-Integrated-4.0a" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" /> 
    <add name="ExtensionlessUrlHandler-Integrated-4.0b" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" /> 

Ecco ... Ha funzionato.

+0

Non è lo stesso gestore? Perché è necessario aggiungerlo due volte con un nome diverso? –

0

Ho riscontrato un problema simile a questo.

cosa ha funzionato per me è stato quello di rimuovere, quindi aggiungere nuovamente il gestore:

La mia ipotesi è che se di default questo è attivata nel server IIS già, può innescare questo errore.

Sto usando IIS 10, MVC 5, .NET Framework 4.6.1

Spero che questo aiuti :-)